https://school.programmers.co.kr/learn/courses/30/lessons/68935
class Solution {
public int solution(int n) {
int answer = 0;
String temp = Integer.toString(n, 3); // 10์ง๋ฒ -> 3์ง๋ฒ
String reverse = "";
for (int i = temp.length() - 1; i >= 0; i--) { // 3์ง๋ฒ ์์์ ์๋ค ๋ฐ์
reverse = reverse + temp.charAt(i);
}
answer = Integer.parseInt(reverse, 3); // ๋ฐ์ ํ 3์ง๋ฒ -> 10์ง๋ฒ
return answer;
}
}