From 8c578d154c5794995ebf143a78e1d2088d5979b8 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Tue, 21 Oct 2025 22:50:25 +0900 Subject: [PATCH] =?UTF-8?q?[20251021]=20PGM=20/=20LV2=20/=20=EB=8B=A4?= =?UTF-8?q?=EC=9D=8C=20=ED=81=B0=20=EC=88=AB=EC=9E=90=20/=20=EC=9D=B4?= =?UTF-8?q?=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... \355\201\260 \354\210\253\354\236\220.md" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "LiiNi-coder/202510/21 PGM \353\213\244\354\235\214 \355\201\260 \354\210\253\354\236\220.md" 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; + } +} +```