158. Bitwise AND of Numbers Range
MediumBit Manipulation
Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive.
Examples
Input: 5 7
Output: 4
Explanation: 5 & 6 & 7 = 4 (the common prefix '1' of 101 and 111, then zeros).
Constraints
- 0 <= left <= right <= 2^31 - 1
Loading...
Run checks all cases above. Submit evaluates all test cases.