Bitwise AND of Numbers Range
MediumBit Manipulation & Math
Decode it first. Clues, constraints, pattern and plan before any code.Given two integers left and right that describe the range [left, right], return the bitwise AND of all numbers in this range, inclusive.
left = 5, right = 7 → 4 (101 & 110 & 111 = 100)
left = 0, right = 0 → 0
left = 1, right = 2147483647 → 0Constraints
0 <= left <= right <= 2^31 - 1