Pow(x, n)
Problem statement
Return x raised to the integer power n.
For a negative exponent, return the reciprocal of the corresponding positive power.
Function
myPow(x: double, n: int) → doubleExamples
Example 1
x = 2.0n = 10return = 1024.0Two multiplied ten times is 1024.
Example 2
x = 2.0n = -2return = 0.25A negative exponent takes the reciprocal.
Constraints
-100.0 < x < 100.0.nis a 32-bit signed integer.- Inputs avoid undefined division by zero.