You are given two whole numbers, left and right, with left <= right. Think of every whole number from left to right, including both ends.
Combine all these numbers with the bitwise AND operation (a bit of the result is 1 only when that bit is 1 in every number). Return the result.
Examples
Example 1:
Input: left = 12, right = 15
Output: 12
Explanation: In binary, 12 to 15 are 1100, 1101, 1110 and 1111. Only the top two bits are 1 in all of them, which gives 1100.
Example 2:
Input: left = 6, right = 7
Output: 6
Explanation: 110 AND 111 is 110, which is 6.
Example 3:
Input: left = 9, right = 16
Output: 0
Explanation: The range crosses from 15 to 16, and the numbers share no common bit, so the result is 0.