diff --git "a/LiiNi-coder/202510/21 PGM \353\213\244\354\235\214 \355\201\260 \354\210\253\354\236\220.md" "b/LiiNi-coder/202510/21 PGM \353\213\244\354\235\214 \355\201\260 \354\210\253\354\236\220.md" new file mode 100644 index 00000000..878d56a4 --- /dev/null +++ "b/LiiNi-coder/202510/21 PGM \353\213\244\354\235\214 \355\201\260 \354\210\253\354\236\220.md" @@ -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; + } +} +```