1845. Seat Reservation Manager
On This Page
class SeatManager:
def __init__(self, n: int):
self.q = list(range(1, n + 1))
heapify(self.q)
def reserve(self) -> int:
return heappop(self.q)
def unreserve(self, seatNumber: int) -> None:
heappush(self.q, seatNumber)
# Your SeatManager object will be instantiated and called as such:
# obj = SeatManager(n)
# param_1 = obj.reserve()
# obj.unreserve(seatNumber)