Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 273 Bytes

461.md

File metadata and controls

23 lines (14 loc) · 273 Bytes

461 Hamming Distance

Description

link


Solution

  • See Code

Code

O(n)

class Solution:
    def hammingDistance(self, x: int, y: int) -> int:
        return bin(x^y).count('1')