Pow(x,n)
Math
medium
Score: 10
Implement pow(x, n), which calculates x raised to the power n.
Return the number
Input Format
First Parameter - number x
Second Parameter - number n
Output Format
Return the number.
Example 1:
Input:
3
4
Output:
81
Example 2:
Input:
7
5
Output:
16807
Constraints
- -10< x < 10
- 0 <= n <= 5
- Expected Time Complexity: O(log n)
- Expected Space Complexity: O(1)