Pow(x, n)
Input:
2.00000, 10
Output:
1024.00000Input:
2.10000, 3
Output:
9.26100Input:
2.00000, -2
Output:
0.25000
Explanation:
2
-2
= 1/2
2
= 1/4 = 0.25Analysis

Solution
Fast Power Iterative - O(logn) time
Fast Power Recursive - O(logn) time - (8 ms, faster than 83.96%)
Last updated