Design a seat reservation system that always returns the smallest available seat number when reserving. The structure should also support unreserving a seat and making it available again.
n = total seats, operations = method names, values = associated seat numbers when needed
results of reserve operations in order; unreserve returns null
Example 1:
Input:
n = 5 operations = ["reserve","reserve","unreserve","reserve"] values = [0,0,2,0]
Output:
[1,2,null,2]
Explanation:
Seats are reserved in increasing order; seat 2 becomes available again after unreserving.
Example 2:
Input:
n = 3 operations = ["reserve","reserve","reserve"] values = [0,0,0]
Output:
[1,2,3]
Explanation:
The smallest available seat is chosen each time.