Bitwise AND of Numbers Range

Medium

Company Tags

You are 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 = 1, right = 5

Output: 0

Example 2:

Input: left = 10, right = 12

Output: 8

Constraints:

  • 0 <= left <= right <= ((2^31)-1)


Company Tags

Please upgrade to NeetCode Pro to view company tags.

left =

right =