No Matter, if you have solved it or not, or even watched any other video, I'll highly recommend to watch the video entirely !! ❤ Checkout DSA-169 Series: ruclips.net/video/5BuKVS-Vnws/видео.html Problem Link: leetcode.com/problems/non-overlapping-intervals/description/ Code & Notes: drive.google.com/file/d/1H47g4O1yswIqjkaxRTgNpkIgAHGNZ3CT/view?usp=sharing
Bro just quit your job and start teaching and start a start-up bro for sure, sure you will build a big company trust me your way of explanation is next level❤🔥
there are 100's of people doing the same thing and only 3 or 4 are successful, and he is not getting enough views already therefore he can't compete with giants.
I have solved this problem before, but the intuition was never so clearer. One request, I found it hard to understand the better approach O(NlogN). If you could explain it, it would have been better
The reason behind sorting according to end time so that we can get those intervals which end first before and hence maximise the number of intervals, or in other words, minimise the no of erases. For eg: consider an interval 1,10 2,3 3,4 4,5 5,6 6,7 7,8 If we sort according to starting time, we would include 1,10 which would invariably prevent us from taking 2,3 3,4 4,5 5,6 6,7 7,8
No Matter, if you have solved it or not, or even watched any other video, I'll highly recommend to watch the video entirely !! ❤
Checkout DSA-169 Series: ruclips.net/video/5BuKVS-Vnws/видео.html
Problem Link: leetcode.com/problems/non-overlapping-intervals/description/
Code & Notes: drive.google.com/file/d/1H47g4O1yswIqjkaxRTgNpkIgAHGNZ3CT/view?usp=sharing
He literally wrote BUT BUT BUT ( Hold your Horses ) in the notes . OP😂🔥
Bro just quit your job and start teaching and start a start-up bro for sure, sure you will build a big company trust me your way of explanation is next level❤🔥
there are 100's of people doing the same thing and only 3 or 4 are successful, and he is not getting enough views already therefore he can't compete with giants.
Thank you 😊
Awesome explanation man !!
good explanation!
I have solved this problem before, but the intuition was never so clearer.
One request, I found it hard to understand the better approach O(NlogN). If you could explain it, it would have been better
Thank you again for another great video!
why sort according to end times, i did it with same logic and just did it with start times, and i only passed some test cases
Also works when we sort with starting time
@@phoenix_1_3 send your code bro
@@phoenix_1_3 No, it does not
The reason behind sorting according to end time so that we can get those intervals which end first before and hence maximise the number of intervals, or in other words, minimise the no of erases.
For eg: consider an interval 1,10 2,3 3,4 4,5 5,6 6,7 7,8
If we sort according to starting time, we would include 1,10 which would invariably prevent us from taking 2,3 3,4 4,5 5,6 6,7 7,8
@@bentenison3409
class Solution {
public:
int eraseOverlapIntervals(vector& intervals) {
sort(begin(intervals), end(intervals));
int res = 0, n = size(intervals);
int prev = INT_MIN;
for(auto &i : intervals){
if(i[0] < prev) {
res++;
prev = min(prev, i[1]);
}
else prev = i[1];
}
return res;
}
};
Please make a Bit manipulation playlist
trying to come close just like situationship .