A seating app assigned seats 1 to n to n guests, but a bug gave one seat to two guests, so one seat was left empty. The assigned seat numbers are in seats.
Write seatMismatch(seats) that returns [doubleBooked, empty]. You may reorder seats.
Input: seats = [3,1,3,4,5] Output: [3,2]
Seat 3 was given out twice and seat 2 to nobody.
Input: seats = [1,1] Output: [1,2]
Seat 1 was given to both guests.
2 <= seats.length <= 5 * 10^51 <= seats[i] <= seats.lengthRun tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #72 Double-Booked and Empty Seat. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.