Saturday, November 18, 2017

461. Hamming Distance

class Solution:
    def hammingDistance(self, x, y):
        """
        :type x: int
        :type y: int
        :rtype: int
        """
        return bin(x ^ y).count('1')

No comments:

Post a Comment