Beakjoon&프로그래머스/Java
[프로그래머스/Java] 3진법 뒤집기
현장
2025. 2. 25. 17:46
-Code
class Solution {
public int solution(int n) {
StringBuilder sb = new StringBuilder(Integer.toString(n, 3));
return Integer.parseInt(sb.reverse().toString(), 3);
}
}