Saturday, November 25, 2017

476. Number Complement

class Solution:
    def findComplement(self, num):
        """
        :type num: int
        :rtype: int
        """
        return int((len(bin(num))-2)*"1", 2)^num

No comments:

Post a Comment