python 65ms beat 100%

  • 0

    Any suggestions are appreciated.

    class Solution(object):
        def hammingDistance(self, x, y):
            :type x: int
            :type y: int
            :rtype: int
            count = 0
            while x or y:
                if x%2 != y%2:
                    count += 1
                x,y = x/2,y/2
            return count

Log in to reply

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