Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public int rangeBitwiseAnd(int m, int n) {
- if (n == m) {
- return n;
- }
- if (n - m == 1) {
- return n & m;
- }
- return rangeBitwiseAnd(m / 2, n / 2) << 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment