class Solution:
def myPow(self, x: float, n: int) -> float:
## Intuitive
return x**n
## O(N)
class Solution:
def myPow(self, x: float, n: int) -> float:
## 分类讨论
## Corner Case
if n == 0:
return 1
elif n < 0:
##
x = 1/x
n = -n
if n%2 ==0:
return self.myPow(x**2,n//2) # 乘子翻倍
return x*self.myPow(x,n-1) # 减1 然后变成偶数个
## O(logN)