Loading...
Loading...
Loading...
A sorted list has an odd number of items. Every value appears exactly twice, side by side, except one value that appears once. Print that value in O(log n) time.
Example
Input
9 1 1 2 3 3 4 4 8 8
Output
2
Try the problem first. Open one hint at a time.
Before the single value, pairs start at even positions. After it, pairs start at odd positions.
Look at the middle, move it to an even position, and check whether it matches the next item.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor