function solution(n) { const reverseTernaryScale = [...n.toString(3)].reverse().join(''); const answer = parseInt(reverseTernaryScale,3) return answer; }