We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10b20a4 commit 6b865f9Copy full SHA for 6b865f9
number-of-1-bits/GangBean.java
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ public int hammingWeight(int n) {
3
+ int count = 0;
4
+ while (n >= 1) {
5
+ count += n % 2;
6
+ n /= 2;
7
+ }
8
+ return count;
9
10
+}
11
+
0 commit comments