Given a number n, compute the value of n raised to the power of its reverse.
Note: The result will always fit within the range of a 32-bit signed integer.
Example 1
Input: n = 3
Output: 27
Explanation: The reverse of 3 is 3, and 3^3 = 27.
Example 2
Input: n = 5
Output: 25
Explanation: The reverse of 5 is 5, and 5^5=25.
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.
5
3125
3
27