Company: Dezerv
Difficulty: medium
Seat reservation Problem Description A movie theater has N seats numbered 1 to N . Build a seat reservation system that performs K operations. Each operation is defined by an element seat[i] from an input array seat : If seat[i] = 0 : Fetches the smallest-numbered unreserved seat, reserves it, and implicitly returns its number (though this returned number is not part of the final output). If seat[i] > 0 : Cancels the reservation for the seat numbered seat[i] . The final result should be an array containing the numbers of all currently reserved seats after all K operations are performed. Constraints Every time a reservation operation ( seat[i] = 0 ) is performed, it is guaranteed that there is at least one unreserved seat available. Every time a cancellation operation ( seat[i] > 0 ) is performed, it is guaranteed that the seat numbered seat[i] is currently reserved. Function Description Complete the function solution() provided in the editor. The function takes the following 3 paramete