As reported: D. E. Shaw senior Futures-team in-office round 4 (2026), after a leaderboard design: design an exponentiation function
a^b(a recursive approach was given in the round).
This is LeetCode 50 — Pow(x, n). Our write-up: /pow-x-n.
Implement myPow(x, n), which returns x raised to the power n, without using a built-in power function.
Example 1
x = 2.00000, n = 10
Output: 1024.00000
Example 2
x = 2.10000, n = 3
Output: 9.26100
Example 3
x = 2.00000, n = -2
Output: 0.25000
Constraints: -100.0 < x < 100.0; -2^31 ≤ n ≤ 2^31 − 1; n is an integer; either x is not zero or n > 0; -10^4 ≤ x^n ≤ 10^4.
Code runner format: one JSON value per line: x, then n. Implement myPow(x, n); the result is printed with 5 decimals.