首页 > 学院 > 开发设计 > 正文

461. Hamming Distance(快速算法)

2019-11-06 08:19:06
字体:
来源:转载
供稿:网友

class Solution(object): def hammingDistance(self, x, y): “”” :type x: int :type y: int :rtype: int “”” result = x^y count = 0 while result: result = result&(result-1) count+=1 return count


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表