Skip to content

Commit f55a273

Browse files
Bitwise AND of Numbers Range
1 parent d7ccef6 commit f55a273

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def rangeBitwiseAnd(self, left: int, right: int) -> int:
3+
count = 0
4+
while (left != right):
5+
left >>= 1
6+
right >>= 1
7+
count += 1
8+
return left << count;

0 commit comments

Comments
 (0)