One-line C++ solution


  • 0
    P

    class Solution {
    public:
    int rangeBitwiseAnd(int m, int n) {
    return (m == n) ? m : (rangeBitwiseAnd(m >> 1, n >> 1) << 1);
    }
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.