tickets in no particular order. The stack is complete if the numbers run consecutively with no gaps and no repeats: if x is the smallest number and n is the number of tickets, then every number from x to x + n - 1 must appear exactly once.
Return True if the stack is complete, and False otherwise.tickets=[14, 12, 15, 13] → True
The smallest number is 12 and there are 4 tickets, so 12, 13, 14 and 15 are needed. All are there.
tickets=[5, 7, 6, 6] → False
The numbers 5, 6, 7 and 8 are needed, but instead of 8 there is a second ticket 6.
tickets=[0, 2] → False
The numbers 0 and 1 are needed, and 1 is missing.
len(tickets) ≤ 10⁵tickets[i] ≤ 10⁹tickets=[14, 12, 15, 13]
True
Run checks the first 3 tests in your browser. Submit checks all 134 tests on the server, hidden ones included.