Bitwise AND of Numbers Range LeetCode solution in Java

1
class Solution {
2
public int rangeBitwiseAnd(int left, int right) {
3
int count = 0;
4
while (left != right) {
5
left >>= 1;
6
right >>= 1;
7
count++;
8
}
9
return right <<= count;
10
}
11
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0