Mid/SeniorBit Manipulation
Bitwise AND of Numbers Range
Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive.
Example 1
Input
left = 5, right = 7Output
4The bitwise AND of all numbers from 5 through 7 is 4.
Example 2
Input
left = 0, right = 0Output
0The only number in the range is 0, so the result is 0.
Constraints
- 0 <= left <= right <= 2^31 - 1