The most easy question in leetcode


  • 0
    Q
      public int hammingDistance(int x, int y) {
    		int t = x ^ y;
    		int value = 0;
    		while (t != 0) {
    			if ((t & 1) == 1)
    				value++;
    			t = t >> 1;
    		}
    		return value;
    
    	}
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.