class Solution {
public:
int rangeBitwiseAnd(int m, int n) {
int t=m&n,ans=0;
n-=m;
while(t){
int k=t&-t;
if(k>=n) ans+=k;
t-=k;
}
return ans;
}
};
Leetcode 201. 数字范围按位与
最新推荐文章于 2024-03-06 17:19:30 发布