diff --git "a/lkhyun/202510/13 PGM Lv2 \354\235\264\354\247\204 \353\263\200\355\231\230 \353\260\230\353\263\265\355\225\230\352\270\260.md" "b/lkhyun/202510/13 PGM Lv2 \354\235\264\354\247\204 \353\263\200\355\231\230 \353\260\230\353\263\265\355\225\230\352\270\260.md" new file mode 100644 index 00000000..30e150ea --- /dev/null +++ "b/lkhyun/202510/13 PGM Lv2 \354\235\264\354\247\204 \353\263\200\355\231\230 \353\260\230\353\263\265\355\225\230\352\270\260.md" @@ -0,0 +1,25 @@ +```java +class Solution { + static int convertCnt = 0; + static int zeroCnt = 0; + public int[] solution(String s) { + while(!s.equals("1")){ + s = convertToBinary(s); + convertCnt++; + } + return new int[]{convertCnt,zeroCnt}; + } + public String convertToBinary(String s){ + String removedZero = s.replaceAll("0",""); + int num = removedZero.length(); + zeroCnt += s.length() - num; + StringBuilder sb = new StringBuilder(); + + while(num > 0){ + sb.append(num%2); + num /= 2; + } + return sb.reverse().toString(); + } +} +```