laizimo / zimo-article

:books:博客——源于实践,乐于分享,欢迎Star~

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leetcode算法题

laizimo opened this issue · comments

  1. 海明距离(Hamming distance)

    **题目:**The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.

    **翻译:**两个整数之间的海明距离是在相应的位不同的位置数目。给两个整数x和y,计算海明距离

    题目链接

    思路解析:可以通过将两个整数异或,然后计算二进制中的1的数目,即是海明距离。

    位操作符详解:
    &:按位与 |:按位或 ^:按位异或 >>:右移,相当于除2 >>:左移,相当于除3

这个部分已经被我转移到新项目中。项目地址