public static String solution(int n) {
StringBuilder temp = new StringBuilder();
while (n != 0) {
if (n % 3 != 0) {
temp.append(n % 3);
n /= 3;
} else {
temp.append("4");
n = n / 3 - 1;
}
}
return temp.reverse().toString();
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/12899