values sorted in non-decreasing order. Every number in it appears exactly twice, except one number that appears exactly once. Find and return that number.
A linear pass is easy. Aim for O(log n) time and O(1) extra memory.values=[2, 2, 5, 5, 6, 9, 9] → 6
Every number comes in a pair except 6.
values=[0, 4, 4, 7, 7] → 0
The lone number can sit at the very start.
values=[13] → 13
values is sorted in non-decreasing ordervalues=[2, 2, 5, 5, 6, 9, 9]
6
Run checks the first 3 tests in your browser. Submit checks all 115 tests on the server, hidden ones included.