首页 > 其他 > 详细

LeetCode之461. Hamming Distance

时间:2016-12-31 23:46:00      阅读:322      评论:0      收藏:0      [点我收藏+]

技术分享

------------------------------------------------------------------

 

AC代码:

public class Solution {
    public int hammingDistance(int x, int y) {
        return Integer.toString(x^y,2).replaceAll("0","").length();
    }
}

 

 

题目来源: https://leetcode.com/problems/hamming-distance/

 

LeetCode之461. Hamming Distance

原文:http://www.cnblogs.com/cc11001100/p/6240408.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!