OverflowError: (34, 'Numerical result out of range') in writing a custom implementation of pow(x,n)
OverflowError: (34, 'Numerical result out of range') in writing a custom implementation of pow(x,n) Question: While implementing pow(x, n), for (x=2,and n=-2147483648), I am getting the below error: Code : class Solution: def myPow(self, x, n): flag = n < 0 n = -1 * n if flag else n ans = None if n …