What is the memory problem in my method?


  • -1
    M

    def myPow(x, n):
    if n>0:
    return reduce(lambda a,b:ab,[x]n)
    elif n==0:
    return 1
    else:
    return 1.0/(reduce(lambda a,b:a
    b,[x]
    (-n)))


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.