2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402

preview_player
Показать описание
Here in this video we have discussed the approach to solve
2402. Meeting Rooms III of Leetcode Weekly Contest 309

📢📢 Our complete Placement Preparation Series [PPS] :-

After this if you need doubt support join our telegram channel for getting it solved
👇🏻
========================================================================
========================================================================
Link to our other major series:-
========================================================================
Bro Coders leetcode editorial leetcode editorial in hindi leetcode code walkthrough
leetcode solution leetcode best explanation begginer level explanation
Bro Coders leetcode editorial leetcode editorial in hindi leetcode code walkthrough
leetcode solution leetcode best explanation begginer level explanation
Bro Coders leetcode editorial leetcode editorial in hindi leetcode code walkthrough
leetcode solution leetcode best explanation begginer level explanation
Bro Coders leetcode editorial leetcode editorial in hindi leetcode code walkthrough
leetcode solution leetcode best explanation begginer level explanation
Bro Coders leetcode editorial leetcode editorial in hindi leetcode code walkthrough
leetcode solution leetcode best explanation begginer level explanation

2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
2402. Meeting Rooms III | Leetcode Weekly Contest 309 | LeetCode 2402
Рекомендации по теме
Комментарии
Автор

crystal clear bhai, 2 baar dry run kardiya pura samajh agaya

pritishpattnaik
Автор

1 bar me smjh nahi aaya
2nd baar me aagya bhaiya thankyou

Future_software_enginneer
Автор

Why did you sort the array? Nowhere in the video you mentioned sorting the interval array first!

prakharprakash
Автор

nice explanation, i used priority queue to solve, i also handled edge case but still it failed on 66/81 test case .

yourbestie
Автор

Failing last test case, please check if yours is working on new added test case

vishaltewari
Автор

What is written at last 1ll ? In line 29?

genghisda
Автор

sir apko bolne me koi dikkat hoti he kya, jeep fisalti he aapki

gauravsharma-luif
Автор

I did this using 2 priority queues:

class Solution:
def mostBooked(self, n: int, meetings: List[List[int]]) -> int:
meetings.sort()

from heapq import heapify, heappush, heappop

hip = []
empty = []


for i in range(n):

hip.append([0, i, 0])

heapify(hip)
heapify(empty)

for x, y in meetings:

while(hip and hip[0][0]<=x):

last_time, index, counter = heappop(hip)
heappush(empty, [index, counter])

if empty:
index, counter = heappop(empty)
last_time, index, counter = y, index, counter+1
else:
last_time, index, counter = heappop(hip)
last_time, index, counter = last_time+(y-x), index, counter+1

heappush(hip, [last_time, index, counter])

mp = {}
for last_time, index, counter in hip:

if counter not in mp:
mp[counter] = index
else:
mp[counter] = min(mp[counter], index)


for index, counter in empty:

if counter not in mp:
mp[counter] = index
else:
mp[counter] = min(mp[counter], index)


maxi = max(mp.keys())

return mp[maxi]

chetansahu