My 42ms Python Solution


  • 0
    F

    class Solution(object):
    def findComplement(self, num):
    """
    :type num: int
    :rtype: int
    """
    leng=len(bin(num))-2
    b='1'*leng
    return int(b,2)-num


Log in to reply
 

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