Skip to content

Commit

Permalink
update 57 java
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Mar 10, 2024
1 parent 0070bd0 commit e7e9cb4
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public int minMeetingRooms_1(int[][] intervals) {

for (int[] interval : intervals) {
// There's no overlap, so we can reuse the same room.
// peak : Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
if (!minHeap.isEmpty() && interval[0] >= minHeap.peek())
// Retrieves and removes the head of this queue,
minHeap.poll();
minHeap.offer(interval[1]);
}
Expand Down

0 comments on commit e7e9cb4

Please sign in to comment.