Pow(x, n)
Return x raised to integer power n. Negative powers mean reciprocals; exponent zero yields one.
Example 1
x = 2
n = -30.125Explanation
2^-3 is the reciprocal of 222, or 1/8.
Example 2
x = -2
n = 3-8Explanation
An odd power preserves the negative sign, giving -8.
Example 3
x = 3
n = 01Explanation
Any nonzero base to exponent zero equals one.
Example 4
x = 1
n = -21474836481Explanation
Every integer power of one is one, including the minimum signed 32-bit exponent.
Constraints
- -100 < x < 100
- n is a signed 32-bit integer
- x is nonzero when n <= 0
- The result is finite and its absolute value <= 10000
Function contract
myPowArguments: json, jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 34 cases, on your device.
2-3