Skip to content

Commit e7d7c9e

Browse files
authored
Merge pull request #1281 from AlgorithmWithGod/LiiNi-coder
[20251031] PGM / LV2 / 점프와 순간이동 / 이인희
2 parents 75b5f77 + a0ef929 commit e7d7c9e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
```java
2+
import java.util.*;
3+
4+
public class Solution {
5+
public int solution(int n) {
6+
int ans = 0;
7+
8+
while(n != 0){
9+
if(n%2 != 0){
10+
n--;
11+
ans++;
12+
}
13+
n/=2;
14+
}
15+
16+
return ans;
17+
}
18+
}
19+
```

0 commit comments

Comments
 (0)