프로그래머스 3진법 뒤집기
-
Level1) 3진법 뒤집기PS/programmers 2021. 4. 28. 23:06
123456789101112131415161718192021222324252627282930public class Level1_3진법뒤집기 { public static int solution(int n) { int answer = 0; // 10진법 -> 3진법 뒤집은거 StringBuilder reverseThreeRadix = new StringBuilder(); while (n > 0) { reverseThreeRadix.append(n % 3); n /= 3; } // 3진법 -> 10진법 long before10 = Long.parseLong(reverseThreeRadix.toString()); int count = 0; while (before10 > 0) { long index = befo..