标签:nbsp while 距离 bsp python solution leetcode count span
1)取异或,然后计算1的个数
class Solution: def hammingDistance(self, x: int, y: int) -> int: t = x^y count = 0 while t: count += 1 t = t& t-1 return count
标签:nbsp while 距离 bsp python solution leetcode count span
原文地址:https://www.cnblogs.com/cbachen/p/14875071.html