Code
The highlighted line runs next. The pill shows the live values in the running call.
Variables
The data structures the code is building
Exponent
Bits of |n| with the power of x each one stands for
Implement myPow(x, n), which returns x raised to the integer power n (which may be negative), without built-in power functions.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
Bits of |n| with the power of x each one stands for
n means |n|, the size of the exponent. The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. x strictly between −100 and 100, n from −200 to 200 (so the brute force stays steppable), and |xⁿ| ≤ 10⁴ as the problem guarantees.