Maximum Profit in Job Scheduling | Leetcode 1235 | Live coding session | Leetcode Hard | 🔥🔥🔥🔥

preview_player
Показать описание
Here is the solution to "Maximum Profit in Job Scheduling" leetcode question. Hope you have a great time going through it.

1) 0:00 Explaining the problem out loud
2) 1:10 Algorithm walkthrough
3) 2:30 Solution approach
4) 12:00 Coding

For discussion/feedback

PS : Please increase the speed to 1.25X
Рекомендации по теме
Комментарии
Автор

Me : Pretty sure this is a hard problem
Suchit : this is a medium problem
me : hello darkness my old friend

shyamsundar
Автор

we can initially add (0, 0) to the treemap to get rid of the condition check for the maxProfitTillStartTime.
Great Solution🔥

piyushacharya
Автор

Really appreciate the way you explain the logic with the visual presentation. Keep up the good work! :)

elasingh
Автор

sorry im confused a little but the complexity of this code is O(nlogn)??

amrholo
Автор

What if there is more than one work ending at same time ?
Then how this algorithm will work ?
Please explain

entertainmentiseverything
Автор

but when it comes to implementation in cpp it's tricky part because there is no floor key and also sorting the list of lists according to a index directly as inbuilt functions ??😟

ramyasree
Автор

Nice explanation your videos are really good...keep making such videos

paragroy
Автор

What matters more in a resume to get shortlisted A good project or A good dsa problm profile

sakshamsengar
Автор

Is it possible to solve this by sorting the start times?

harshavardhanm
Автор

Can you please explain me this statement: Collections.sort(jobs, (a, b)->(a.endTIme-b.endTime)); I have seen it many times but I am not quite clear with what it signifies.

anupamdungdung
Автор

Thank you for describing the algorithm but there is something missing in the provided explanation.(minte 3 to minute 12) When calculating the profit before or equal to startTime, you are actually getting the max profit before that. As per explanation, if two jobs would have the same start/end time, you would't know which to select. The idea of ans = Max(ans, jobProfit), map.save(endtime, ans) is missing in the explanation but it's put into the code. I am say this as I implemented the algorithm as explanined and wasn't working. I had to figure out that you actually get the maxValue of headMap(startTime).

TheStefannel
Автор

The value for <5> in the tree map should be 10 instead of 5, isn't it?

jeremyshi
Автор

Thanks, Suchit.
Please make a video on Leetcode 115 (distinct-subsequences).

jatinthakwani
Автор

c++ walo ke liye bhi solution dijiye bhaiya

ecepranaykumar