Flipping bits

  • + 0 comments
    def flippingBits(n):
        num_bits = 32
        mask = (1 << num_bits) - 1
        ans = mask - n
        return ans