Hamming distance- leetcode
来源:互联网 发布:数组怎么用 编辑:程序博客网 时间:2024/06/01 14:24
开启leetcode刷题模式
今天只做了最简单的 Hamming distance
class Solution(object): def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int result = bin(x^y).replace('0b','') result = str(result) count=0 for c in result: if c == '1': count+=1 return count """ return bin(x^y).count('1')
阅读全文
0 0
- LeetCode 461. Hamming Distance
- 【Leetcode】461. Hamming Distance
- [LeetCode-461]Hamming Distance
- LeetCode 461. Hamming Distance
- [LeetCode]Hamming Distance
- Leetcode 461 Hamming Distance
- LeetCode - 461. Hamming Distance
- LeetCode-461. Hamming Distance
- Leetcode 461 Hamming Distance
- 【LeetCode】 461. Hamming Distance
- leetcode-461-Hamming Distance
- Leetcode Hamming Distance
- leetcode 461: Hamming Distance
- Leetcode-461. Hamming Distance
- leetcode--461 : Hamming Distance
- Leetcode 477: hamming distance
- Leetcode 461. Hamming Distance
- LEETCODE--Hamming Distance
- 说文解字 —— 拆字
- Android硬件加速问题
- 浅谈C++类中的默认成员函数
- PHP魔术方法 __sleep和__wakeup()
- leetcode: 628. Maximum Product of Three Numbers
- Hamming distance- leetcode
- centos7 安装mysql57
- JPA入门例子(采用JPA的hibernate实现版本)
- Spring4.X 与 Hibrenate5.X整合
- CSS之Multi-columns的跨列
- 如何优化eclipse?eclipse启动很卡,很慢?性能不好?
- 递归算法及应用
- Unity5.x Time用法详解
- linux虚拟终端之screen命令