Switch Off the Lowest One
Return n with its lowest 1 bit switched off. Every other bit stays as it is. If n is 0 there is nothing to switch off, and the answer is 0.
For example 12 is 1100 in binary. Its lowest 1 is the one worth 4, so the answer is 1000, which is 8.
Example 1
n 12
returns 8
12 is 1100. Without its lowest 1 it is 1000.
Example 2
n 7
returns 6
7 is 111. Without its lowest 1 it is 110.
Example 3
n 16
returns 0
A power of two has a single 1, so nothing is left.
Constraints
0 <= n <= 10**9
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.