simple golang solution


  • 0
    D
    func rangeBitwiseAnd(m int, n int) int {
        base := uint(0)
        for m!=0 && m!=n {
            m >>= 1
            n >>= 1
            base++
        }
        return m << base
    }
    

Log in to reply
 

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