[Python]Hamming distance 问题

In [75]: x=4

In [76]: y=1

In [77]: str(bin(x ^ y))[2:].count('1')

Out[77]: 2

In [78]:

来自:https://leetcode.com

 

posted @ 2017-09-24 20:07  健哥的数据花园  阅读(491)  评论(0编辑  收藏  举报