class Solution {
// 3진법으로 변환후 10진법으로 변환
public int solution(int n) {
/*
N진법을 -> 10진법으로
Integer.parseInt(i,N);
*/
int answer;
String result = "";
// 45
// while문을 통해 3진법
while (n != 0) {
result += n % 3;
n /= 3;
}
// 0021이 담긴 String 에서 10진법으로 변환
answer = Integer.parseInt(result, 3);
return answer;
}
}