As reported: Goldman Sachs Associate technical DSA round (~1 hour, shared editor, 2026): implement
pow(base, exp), the first of two questions.
Implement myPow(x, n), which returns x raised to the integer power n (which may be negative).
This is LeetCode 50 — Pow(x, n).
Example 1
x = 2.00000, n = 10
-> 1024.00000
Example 2
x = 2.10000, n = 3
-> 9.26100
Example 3
x = 2.00000, n = -2
-> 0.25000
Constraints: -100.0 < x < 100.0; -2^31 ≤ n ≤ 2^31 - 1; n is an integer; either x ≠ 0 or n > 0; -10^4 ≤ xⁿ ≤ 10^4.
Code runner format: one JSON value per line: x, then n (LeetCode's test-case format). Implement myPow(x, n); the harness prints the result as JSON.