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 8c45364 commit 1da6b0cCopy full SHA for 1da6b0c
0224LJH/202512/13 PGM 다음ㅁ 큰 숫자.md
@@ -0,0 +1,33 @@
1
+```java
2
+import java.io.*;
3
+import java.util.*;
4
+
5
+class Solution {
6
+ public int solution(int n) {
7
8
+ int goalCnt = getTwoCnt(n);
9
10
+ int num = n+1;
11
12
+ while (true){
13
+ int target = num;
14
+ int tempTwoCnt = getTwoCnt(target);
15
+ if (tempTwoCnt == goalCnt) {
16
+ break;
17
+ }
18
+ num++;
19
20
+ return num;
21
22
23
+ public int getTwoCnt(int n){
24
+ int result = 0;
25
+ while (n > 0){
26
+ if (n%2 != 0) result++;
27
+ n /=2;
28
29
30
+ return result;
31
32
+}
33
+```
0 commit comments