Compute efficiently for a real base and integer exponent.
Given a real number x and a 32-bit signed integer n, return the value of .
Your solution should handle positive, negative, and zero exponents. Since n may be negative, the result may be a fraction. Use an approach that is efficient enough for large exponent values.
xnn fits in a 32-bit signed integer.x is a real number.|n|.n is a 32-bit signed integer.x is a real number.|n|.Example 1
Input
x = 2.00000, n = 10
Output
1024.00000
Explanation
.
Example 2
Input
x = 2.10000, n = 3
Output
9.26100
Explanation
.
Example 3
Input
x = 2.00000, n = -2
Output
0.25000
Explanation
.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.