class Solution {
public int rangeBitwiseAnd(int left, int right) {
int shift = 0;
while (left != right) {
left >>= 1;
right >>= 1;
shift++;
}
return left <<= shift;
}
}
201. 数字范围按位与
最新推荐文章于 2024-09-08 12:41:07 发布