https://leetcode-cn.com/problems/powx-n/
def myPow(x, n):
"""
Pow(x, n)
"""
if n in (1, 0, -1): return x ** (n)
return myPow(x, n // 2) ** 2 * (x if n % 2 != 0 else 1)
https://leetcode-cn.com/problems/powx-n/
def myPow(x, n):
"""
Pow(x, n)
"""
if n in (1, 0, -1): return x ** (n)
return myPow(x, n // 2) ** 2 * (x if n % 2 != 0 else 1)