87. Pow(x, n)

Implement raising a number x to the power n (x^n).
Example 1
Input: x = 2, n = -2
Output: 0.25
Explanation: 2^(-2) = 1/4 = 0.25.
Example 2
Input: x = 2, n = 10
Output: 1024
Explanation: 2^10 = 1024.
mediumrecursion
JavaScript
Loading...
Line 1, Char 1