Implement pow(x, n)

0
Remix

Compute x raised to an integer power n (which may be negative) in O(log n) multiplications by squaring, rather than multiplying n times. Handle n = 0, negative exponents and overflow at the edge of the integer range.

MetaTechnical phone screenLast asked Apr 2026
No answer yet. Write the first one; the best answer gets endorsed.