top. Find the largest integer x ≤ top such that the bitwise AND of every number from x to top inclusive equals zero.top=12 → 7
The AND of 8 through 12 is 8, but adding 7 (0111 in binary) brings it down to 0.
top=1 → 0
The range [1, 1] gives 1, while [0, 1] already gives 0.
top=32 → 31
top=12
7
Run checks the first 3 tests in your browser. Submit checks all 74 tests on the server, hidden ones included.