Skip to content

Commit c0675dc

Browse files
authored
[20251015] PGM / Lv2 / 점프와 순간 이동 / 이강현
1 parent 17718c9 commit c0675dc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 /= 2;
11+
}else{
12+
ans++;
13+
n--;
14+
}
15+
}
16+
17+
return ans;
18+
}
19+
}
20+
```

0 commit comments

Comments
 (0)