tickets (positive integers; numbers may repeat).
First you may raise each number by 1 or leave it alone, deciding separately for every ticket. Then you pick some tickets whose numbers, once sorted, are **consecutive with no gaps and no repeats**: [5, 6, 7] works, while [5, 7] and [5, 5, 6] do not.
Return the largest number of tickets you can pick.tickets=[4, 2, 7, 2, 5] → 4
Raise one of the 2s to 3: that gives 2, 3, 4, 5, four numbers in a row.
tickets=[1, 5, 9] → 1
Every two numbers are more than 2 apart, so only one can be taken.
tickets=[3, 3, 3] → 2
Keep one 3 and raise another to 4; the third 3 cannot help, so the answer is 2.
tickets=[4, 2, 7, 2, 5]
4
Run checks the first 3 tests in your browser. Submit checks all 147 tests on the server, hidden ones included.