values holds badge numbers. Every number appears exactly once except one, which is logged twice or more.
Return that number.
If the repeated number fills exactly half of the log, can you solve it without extra memory?values=[6, 8, 6, 1] → 6
The 6 appears twice and the other numbers once each.
values=[7, 0, 4, 7, 9, 7] → 7
The 7 appears three times: the repeated number may show up any number of times.
values=[12, 3, 5, 8, 12] → 12
values=[6, 8, 6, 1]
6
Run checks the first 3 tests in your browser. Submit checks all 89 tests on the server, hidden ones included.