Pow(x, n) Problem

Pow(x, n) Problem — ExecCode Medium DSA Practice

Solve the Pow(x, n) problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Implement pow(x, n), which calculates x raised to the power n (i.e., xⁿ). Use fast exponentiation by squaring. For Pow(x, n), focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input x = 2.0, n = 10; Output 1024.0

Constraints

-100.0 0 -10^4 ≤ xⁿ ≤ 10^4

Practice Pow(x, n) free on ExecCode. Browse DSA problems, topic map, and placement guides.