Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions LiiNi-coder/202510/21 PGM 다음 큰 숫자.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```java
class Solution {
public int solution(int n) {
int answer = 0;
int i = n+1;
int n1 = get1OfBinary(n);
while(get1OfBinary(i) != n1){
i++;
}
return i;
}
public static int get1OfBinary(int n){
int result = 0;
while(n>1){
result += n%2;
n/=2;
}
if(n==1){
result++;
}
return result;
}
}
```