sweet1cris

Untitled

Feb 5th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.25 KB | None | 0 0
  1.  
  2. public class Solution {
  3.     public int rangeBitwiseAnd(int m, int n) {
  4.         if (n == m) {
  5.             return n;
  6.         }
  7.         if (n - m == 1) {
  8.             return n & m;
  9.         }
  10.         return rangeBitwiseAnd(m / 2, n / 2) << 1;
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment