Your explanation with an intuitive example makes your video super clear. Logic is clear and just save me a lot of time to understand this problem. However, there is one small mistake is that you don't need to keep the max heap deepth as you never pop without a push. I really appreciate your video. Thanks!
Thank you so much for the amazing answer! I'm wondering if it is ok to remove lines 5 and 11, and just return len(heap), it works in leetcode but I just want to confirm with you😊
Found a way without heap. What do you think ? starttime = sorted(i[0] for i in numbers) endtime = sorted(i[1] for i in numbers) starp = 0 endp = 0 usedrooms = 0 L = len(numbers) while starp < L: if starttime[starp] >= endtime[endp]: usedrooms-=1 endp+=1 else: usedrooms+=1 starp+=1 print(usedrooms)
Hey Kuntal! I think this is def an interesting approach! I'd recommend running it directly in leetcode to see the errors/debug. As it is right now, I believe it won't produce the right answer. Correct me if I'm wrong, but sorting separately for the start and end times breaks up the intervals, and we won't be able to see how many rooms would be needed. Are you simply trying to see overlap right now? Love that you are exploring alternative solutions though!!:)
@@DEEPTITALESRA thanks for the reply. I did try on leetcode and it got accepted. Yes, I just try to see the overlap and if not, not increasing the count.
After so many tutorials never explaining "why" we're comparing min end time to next start time, I FINALLY get it. Thank you!
AHH so glad to hear that!! Thanks sm Kyle!!:))
this is super!! love it - love the way you walk through the examples step by step!
I love your explanations! Especially when you walk through the code after you're done!
So glad to hear that!! Thank you so much Manisha!!!:))
Deepti among all the LC you tubers I like how you explain and walk us through an example. Also I use Python so i am so grateful to your videos.
Ahhh thank you so much Raunak!! Love to hear it!!:))
this was definitely the best most intuitive vid i could find on this problem. thank you!!
Aw thx so much - love to hear it!:))
Your explanation with an intuitive example makes your video super clear. Logic is clear and just save me a lot of time to understand this problem. However, there is one small mistake is that you don't need to keep the max heap deepth as you never pop without a push. I really appreciate your video. Thanks!
very clear explanation. Thanks for sharing !
yasss!! thank you sm!!
thank you , the best explanation for this question❤
very interesting and nice explanation .thank you for explaining so clearly and loved the walkthrough..
ofcc thank you so much!!:))
Love your dark background 👍👍🥂
Dark ides all the wayyyyy
thank you so much. I implemented this in C after seeing your explaination.
ofc love to hear that Kshitish!:)
Thanks - this explanation was great
Thanks so much Michael!:))
Great explanation 🤩
Thanks sm Venkata!!:)
Thank you so much for the amazing answer! I'm wondering if it is ok to remove lines 5 and 11, and just return len(heap), it works in leetcode but I just want to confirm with you😊
Yo bro🫡🐐amazing explanation
Enjoyed this one too.
Yay!!:)) ty Samson!
great thank you
well explained
thx Chandra!:))
yayyyy
I just wanna say you are really so cuteeee!!
super helpful!!!!!
THANK YOUUUU
Found a way without heap. What do you think ?
starttime = sorted(i[0] for i in numbers)
endtime = sorted(i[1] for i in numbers)
starp = 0
endp = 0
usedrooms = 0
L = len(numbers)
while starp < L:
if starttime[starp] >= endtime[endp]:
usedrooms-=1
endp+=1
else:
usedrooms+=1
starp+=1
print(usedrooms)
Hey Kuntal! I think this is def an interesting approach! I'd recommend running it directly in leetcode to see the errors/debug. As it is right now, I believe it won't produce the right answer. Correct me if I'm wrong, but sorting separately for the start and end times breaks up the intervals, and we won't be able to see how many rooms would be needed. Are you simply trying to see overlap right now? Love that you are exploring alternative solutions though!!:)
@@DEEPTITALESRA thanks for the reply. I did try on leetcode and it got accepted. Yes, I just try to see the overlap and if not, not increasing the count.
@@Kuntalsh OOhh I see! That's also a nice solution that works in O(nlogn) and O(n) time and space!
damn she fine
WHY THE FUCK WE NEED A MIN HEAP
Dislike for low volume 😢
lol you can increase volume on RUclips on the bottom left of the bar - let me know if that helps!
@@DEEPTITALESRA no mam it doesn't 😞