其他分享
首页 > 其他分享> > 461.Hamming Distancec

461.Hamming Distancec

作者:互联网

class Solution {
public:
    int hammingDistance(int x, int y) {
        int nTemp = x^y;
        int nCount = 0;
        while(nTemp > 0)
        {
            nCount = nCount + (nTemp&1);
            nTemp = nTemp >> 1;
        }
        
        return nCount;
    }
};
 

标签:nTemp,int,hammingDistance,461,nCount,Solution,Distancec,Hamming
来源: https://blog.csdn.net/dw903632958/article/details/101268562