Back to problems

Airplane Seat Reservation API

Object-Oriented Programming · Apple · Medium

Requirements Create the API below: reserveSeat must: Yield 0 when the reservation succeeds, and -1 when it does not. Interpret a four-byte seat-label buffer, for example 3C or 6G. Mark the specified seat as reserved when that label is legal and the seat is free. When the requested seat has already been taken and canMove is true, reserve a different legal unoccupied seat instead. Refuse out-of-range row numbers, invalid seat letters, and requests made after every seat is…

Checking your access…