1
class SeatManager {
2
PriorityQueue<Integer> pq;
3
int count;
4

5
public SeatManager(int n) {
6
count = 1;
7
pq = new PriorityQueue();
8
}
9

10
public int reserve() {
11
if (pq.size() == 0) return count++;
12

13
return pq.poll();
14
}
15

16
public void unreserve(int seatNumber) {
17
pq.add(seatNumber);
18
}
19
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0