Skip to content

Commit

Permalink
Improved JAVA
Browse files Browse the repository at this point in the history
  • Loading branch information
MAZHARMIK authored Feb 18, 2024
1 parent a6e4f6e commit 3a7b68e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Arrays/Intervals_Based_Qn/Meeting Rooms III.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,9 @@ class Solution {
// Each room is used 0 times in the beginning
int[] roomsUsedCount = new int[n];

// To store {earliest room empty time, room No.}
PriorityQueue<long[]> usedRooms = new PriorityQueue<>((a, b) -> Long.compare(a[0], b[0]));

// To store rooms that are used
PriorityQueue<Integer> unusedRooms = new PriorityQueue<>();
var usedRooms = new PriorityQueue<long[]>((a, b) -> a[0] != b[0] ? Long.compare(a[0], b[0]) : Long.compare(a[1], b[1]));
var unusedRooms = new PriorityQueue<Integer>();

for (int room = 0; room < n; room++) {
unusedRooms.add(room); // All rooms are unused in the beginning
}
Expand Down

0 comments on commit 3a7b68e

Please sign in to comment.