Skip to content

Commit 06ecedd

Browse files
committed
number-of-1-bits solution
1 parent 17666b7 commit 06ecedd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

number-of-1-bits/ohgyulim.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
/* 시간 복잡도: O(1)
3+
*
4+
* 공간 복잡도: O(1)
5+
*/
6+
public int hammingWeight(int n) {
7+
return Integer.bitCount(n);
8+
}
9+
}
10+

0 commit comments

Comments
 (0)