Advertisement
tanchukw

Untitled

Sep 10th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int rangeBitwiseAnd(int m, int n) {
  4.         int x = 0;
  5.         while ((m|x) < n)
  6.             x = (x<<1) | 1;
  7.         return m & ~x;
  8.     }
  9. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement