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.

Constraints

  • 0 <= left <= right <= 2^31 - 1
Saving… · 3 lines
class Solution:
def bitwiseAndRange(self, left: int, right: int) -> int:
pass
Console

Click Run to execute sample tests.