so this is maybe the fourth or fifth time im stumbling upon tech does solution and your videos are really good. you focus on explaining the algorithm. thanks so much for making my life easier
@techdose4u4 жыл бұрын
Welcome :)
@shaleen0mishra2 жыл бұрын
Could not get my head around this problem/solution even after referencing multiple 'good' resources. This helped a lot. Great job explaining!
@K_EC_AushoRoup3 жыл бұрын
16/18 test cases passed. I am here because of the remaining test cases. Update: And @7:25 I got my mistake, I was ignoring or leaving the case when one interval will lie completely inside of the other interval. For example, [2,3] is completely inside the [1,4]. And when I handle those case, 18/18 test cases passed. Thanks, sir for such a diagrammatical explanation.
@techdose4u3 жыл бұрын
Welcome :)
@deepanshjohri399711 ай бұрын
Thanks alot sir, I stopped the video at 11:47 and implement the whole code by myself 🙏🙏
@justshanky30123 жыл бұрын
Thank you so much. This looked like a very complicated problem at first. You made it so much simpler
@yjj4104 жыл бұрын
This is similar to problem where arrival/start and departure/end times are given and we have to give maxim number of guests or trains or events that can happen without collision.
@techdose4u4 жыл бұрын
Seems the same.
@shubhamrathi37343 жыл бұрын
I dont see how. In the problem where arrival/start and departure/end times are given and we have to give maximum number of platforms, we dont care about the start time or the end time. In this problem, we very much care about the start times and the end times.
@vcfirefox3 жыл бұрын
please keep doing this for many problems. it is VERY hard to find someone explaining the thought process instead of just writing some code on the videos. keep up the excellent work and I wish you the best of luck
@techdose4u3 жыл бұрын
Thanks 😊
@paragroy53599 ай бұрын
Thanks a lot for making such videos. Great Content
@adityaojha27013 жыл бұрын
Thanks Tech Dose once again!! Keep posting questions like this.
@techdose4u3 жыл бұрын
👍🏼
@大盗江南11 ай бұрын
thank you soooooo much. after working at MS for 2 years, i restart my job hunting journey lol.
@imranimmu4714 Жыл бұрын
Couldnt have found bettter explanation. Thank you.
@pryansh_ Жыл бұрын
No offence madarsa boy but it should have been "couldn't". There is a spelling error too. Ask from them.
@codelite7002 жыл бұрын
Wow, this was much more intuitive.
@johncenakiwi3 жыл бұрын
Amazing explanation. Coded it with ease. Thank you !
@techdose4u3 жыл бұрын
Welcome 😊
@krishnakantsharma61614 жыл бұрын
wow you r awesome u explain each and every corner 👏👏 keep it up i m watching all ur videos
@techdose4u4 жыл бұрын
Thanks
@girikgarg82 жыл бұрын
In overalapping case 2 at 6:52, what if I remove the left interval instead of the right one? Does it make a difference?
@kaushaljalan29284 жыл бұрын
Great effort put up for such an awesome explanation.
@techdose4u4 жыл бұрын
Thanks :)
@rakeshsahni_4 жыл бұрын
Before it I am frustrated but now I fill better Thanks sir
@techdose4u4 жыл бұрын
Welcome :)
@Ice-27064 жыл бұрын
@TECH DOSE you doing a great job! btw very clear and nice explanation as always :) Cheers!
@techdose4u4 жыл бұрын
Thanks
@prasad.patil124 жыл бұрын
Simple and clear explanation 👍
@techdose4u4 жыл бұрын
Thanks :)
@pranavsharma74792 жыл бұрын
all intervals problems are solved by this template thanks a ton
@shubhamagarwal8297 Жыл бұрын
What is the proof for case 2 ? we are removing one of the intervals - greedily removing which one will be better ? Its simply - earlier ending point is given preference case 2 and 3 almost same
@BravePro Жыл бұрын
Didn't get it either. Why remove the one that starts later and ends later? I think it's about that there's more chance that it will be inside another interval later but I can't prove it. It's one of those problems that you shouldn't be thinking too much. Memorize the solution and the *trick* and that's it.
@rachitchaurasia12703 жыл бұрын
just a very small change in this code and we can do this problem also :) :- 452. Minimum Number of Arrows to Burst Balloons
@dovyraj12724 жыл бұрын
Sir can v use , DP and longest increasing sub sequence ?
@Ice-27064 жыл бұрын
yes I have use and got the correct result but this is more efficient approach
@techdose4u4 жыл бұрын
Yep.
@ekengineer98682 жыл бұрын
Awesome Explanatoin
@thinkverse944 жыл бұрын
Nice one.. How you write in such a beautifully .. Are you using mouse only or any electronic writing pad to make video?
@techdose4u4 жыл бұрын
Tablet
@AI_for_funn3 жыл бұрын
u are the saviour
@hardiksardhara33554 жыл бұрын
Great explanation
@techdose4u4 жыл бұрын
Thanks
@jd3287 Жыл бұрын
what about a case 4 where for a interval, there are multiple intervals overlapping?
@_inspireverse___2 жыл бұрын
What's the problem if sort the array in ascending order and removing the interval having larger gap.Because any interval having larger gap ka overlap with max number of intervals. Please Tell 🙏🙏
@shaswatdas65534 жыл бұрын
need correction in 2nd cond i guess if(intervals[left][1]
@abhisheksaraf26163 жыл бұрын
I think we can solve it via dynamic programming also but complexity would be N2
@therealaspirant18824 жыл бұрын
awesome explination bro
@techdose4u4 жыл бұрын
Thanks
@tarungopal30654 жыл бұрын
Superb explanation....
@techdose4u4 жыл бұрын
Thanks
@c.44692 жыл бұрын
How do I prove that this problem can be solved with a greedy approach?
@Voice_Of_Thoughts4 жыл бұрын
Nice explanation
@techdose4u4 жыл бұрын
Thanks
@InvincibleMan993 жыл бұрын
Thanks
@aayush54744 жыл бұрын
Bhaiya aapne mtech ke baad samsung join kiya na? Toh abhi app sde1 ho ya sde2?
@drishtdyumnshrivastava53134 жыл бұрын
misssed 1 condn....btw tnks for the help
@techdose4u4 жыл бұрын
👍
@sudhanshusingh2113 жыл бұрын
can we do it by lcs by sorting by first ???
@hapysethi13064 жыл бұрын
Sir in case 2, can we use Interval [left] [1] > interval [right] [0]. Instead of Interval [left] [1] < interval [right] [1]
@shaswatdas65534 жыл бұрын
Interval [left] [1] > interval [right] [0] this does not ensure that they are overlapping case 1, and they may be overlapping case 2 also. eg: (2,10) and (3,9) 0-------L----------------1 0----R----1 here L(1)>R(0)
@pranavsharma74792 жыл бұрын
@@shaswatdas6553 thnks had same doubt
@amitavamozumder733 жыл бұрын
I tried to do a LIS on the sorted array :P , but this seems faster.
@vijayakumareyunni60102 жыл бұрын
I think the total video time can be reduced by "not reading the input array elements" and avoiding explaining some simple steps. Also, the "overlapping case-3 of case-2 titles" are confusing. To understand the strategy to solve this, one need to wait almost 75% of the time! Thanks for your effort, but, with some improvements your videos will be very helpful.
@rakshith35474 жыл бұрын
just wow
@techdose4u4 жыл бұрын
😃
@shaswatdas65534 жыл бұрын
Python code: def non_overlapping(arr): arr.sort(key=lambda x: [0]) left = 0 right = 1 count = 0 n = len(arr) while right < n: if arr[left][1] =R[0] ''' 0------L--------1 0----R--1 ''' count+=1 left=right right+=1 print(count) ip = [(0, 3), (2, 6), (4, 6), (6, 8)] non_overlapping(ip)