def pow(self, x, n):
if n == 0: return 1
res = self.pow(x*x, int(float(n)/2))
return res if n % 2 == 0 else res * (x if n > 0 else 1/x)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.