Skip to content

Commit

Permalink
461
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Dec 11, 2022
1 parent 6897d8e commit fd73584
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions E_461_HammingDistance.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Solution {
public:
int hammingDistance(int x, int y) {
int last_num = x^y;
int ret=0;
while(last_num){
ret+=last_num&1;
last_num=last_num>>1;
}
return ret;
}
};

0 comments on commit fd73584

Please sign in to comment.