Problem
Implement pow(x, n), which calculatesx raised to the power n (i.e., x<sup>n</sup>).
Examples
Constraints
- -100.0 < x < 100.0
- -2^31 <= n <= 2^31 - 1
nis an integer.- Either
xis not zero orn > 0. - -10^4 <= x^n <= 10^4
Tested Python solution for LeetCode 50 with 16 pytest cases. Generate a practice environment with lcpy.
x raised to the power n (i.e., x<sup>n</sup>).
n is an integer.x is not zero or n > 0.