Power Of Numbers
Medium Acceptance 20.22% Points 30.00
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.
Examples
Example 1
Example 1
Input: n = 3
Output: 27
Explanation: The reverse of 3 is 3, and 3^3 = 27.
Example 2
Example 2
Input: n = 5
Output: 25
Explanation: The reverse of 5 is 5, and 5^5=25.
Hints
Hint 1
Expected Time Complexity: O(log n)
Hint 2
Expected Auxiliary Space: O(log n)
Track your submissions
Please log in to review your progress and explore code submissions from other participants.
Unlock the full solution
Please log in to access detailed answers and explanations.
Join the discussion
Please log in to join conversations with other participants.