Sum vs XOR

  • + 0 comments
    def sumXor(n):
        return 1 << list(bin(n or 1)[2:][::-1]).count('0')