[Java] Leetcode 252/253. Meeting Rooms I/II [Intervals #4]

preview_player
Показать описание
In this video, I'm going to show you how to solve Leetcode 252/253. Meeting Rooms I/II which is related to Intervals.

Here’s a quick rundown of what you’re about to learn:

Course Contents
(0:00​) Leetcode 252
(7:17​) Leetcode 253

In the end, you’ll have a really good understanding on how to solve Leetcode 252/253. Meeting Rooms I/II and questions that are similar to this Intervals.

Now, if you want to get good at Intervals, please checkout my Intervals playlist.

Рекомендации по теме
Комментарии
Автор

love the way how you walk through the problems
Thank you Eric

SHSelect
Автор

we can use priority queue to store the meeting end times, so retrieving the earliest meeting end times takes only O(1) and adding a new meeting end time to priority queue takes O(log n). Overall time complexity - O(nlogn).

Dylan
Автор

indexOf is a linear time operation, but your roomTime array doesnt scale with the input intervals array. So your overall time complexity is still O(nlogn)

Logan
Автор

I'm a little bit confused, the minHeap is to store the meetingRoom ending time, but at the beginning (i.e. line10), it stores the entire intervals (i.e. intervals[0]) rather than the ending time (14:50)?

pengx
Автор

Hm would the time complexity be O(n^2) in worst case?

JustinAllison
Автор

whould the time complexity of leetcode253 be O(nlogn) or o(n) + o(nlogn) ?

MeetManga