Pow(x, n)

Given a number x and an integer n, compute x raised to the power n. This is the canonical fast exponentiation problem and the basis for many modular and number-theory optimizations.

Input Format

x = base, n = exponent

Output Format

x raised to n

Constraints

  • -100.0 <= x <= 100.0; -2^31 <= n <= 2^31 - 1

Examples

Example 1:

Input:

x = 2
n = 10

Output:

1024.0

Explanation:

2^10 = 1024.

Example 2:

Input:

x = 2.1
n = 3

Output:

9.261000000000001

Explanation:

2.1^3 = 9.261.

Loading...
Pow(x, n) - Math DSA Problem