Company: Dezerv
Difficulty: medium
Seat reservation A movie theater has N seats, numbered 1 to N . Every seat starts out unreserved. The box office processes K operations, one after another. Operation i is described by a single integer seat[i] : seat[i] = 0 : a customer asks for a seat. The system hands out the smallest-numbered seat that is currently unreserved and marks it reserved. seat[i] > 0 : the reservation for seat number seat[i] is cancelled. That seat becomes unreserved again and may be handed out by a later request, exactly like any other free seat. After all K operations have been processed, return every seat that is still reserved, in increasing order. (inferred -- the source says only that the result is an array of the reserved seat numbers; this question reports the seats that are still reserved at the end, in increasing order.) Function Description Complete the function solution in the editor. It takes the following parameters: N : the number of seats K : the number of operations seat : an array of K