We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d9a9b89 + 8c578d1 commit f4f090cCopy full SHA for f4f090c
1 file changed
LiiNi-coder/202510/21 PGM 다음 큰 숫자.md
@@ -0,0 +1,24 @@
1
+```java
2
+class Solution {
3
+ public int solution(int n) {
4
+ int answer = 0;
5
+ int i = n+1;
6
+ int n1 = get1OfBinary(n);
7
+ while(get1OfBinary(i) != n1){
8
+ i++;
9
+ }
10
+ return i;
11
12
+ public static int get1OfBinary(int n){
13
+ int result = 0;
14
+ while(n>1){
15
+ result += n%2;
16
+ n/=2;
17
18
+ if(n==1){
19
+ result++;
20
21
+ return result;
22
23
+}
24
+```
0 commit comments