Skip to content

Commit f6785c1

Browse files
committed
leetcode_191
1 parent 81b74b4 commit f6785c1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: 191_Number_of_1_Bits.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public:
3+
int hammingWeight(uint32_t n) {
4+
int ret=0;
5+
do{
6+
if(n&1)
7+
ret++;
8+
} while(n>>=1);
9+
return ret;
10+
}
11+
};

0 commit comments

Comments
 (0)