carloscn / carloscn/structstudy
leetcode461:汉明距离(hamming-distance)
Open
Level-easy
一般问题
位运算
数学
查找
- Dominant language
- C
- Stars
- 4
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
两个整数之间的 汉明距离 指的是这两个数字对应二进制位不同的位置的数目。
给你两个整数 x 和 y,计算并返回它们之间的汉明距离。
示例 1:
输入:x = 1, y = 4
输出:2
解释:
```
1 (0 0 0 1)
4 (0 1 0 0)
↑ ↑
```
上面的箭头指出了对应二进制位不同的位置。
示例 2:
输入:x = 3, y = 1
输出:1
提示:
0 <= x, y <= 231 - 1
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/hamming-distance
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.