MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / Solution

Class Solution

Python/50.Powxn.py:6–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#Memory: 15.17%
5
6class Solution:
7 def myPow(self, x: float, n: int) -> float:
8 if not n: return 1
9 power = self.myPow(x, int(n/2))
10 if n % 2 == 0:
11 return power * power
12 else:
13 return power * power / x if n < 0 else power * power * x

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected