0 to n - 1, each number meant to appear exactly once. Yet n + 2 tickets were collected at the door: two numbers were forged, and each of them appears twice.
You are given the list tickets of collected ticket numbers. Return the two numbers that appear twice, in any order.tickets=[2, 0, 3, 2, 1, 0] → [2, 0]
Here n = 4, so the numbers go from 0 to 3. Both 0 and 2 appear twice.
tickets=[1, 1, 0, 0] → [1, 0]
n = 2, and both numbers are duplicated.
tickets=[2, 0, 3, 2, 1, 0]
[2, 0]
Run checks the first 3 tests in your browser. Submit checks all 51 tests on the server, hidden ones included.