For C++, n should be something bigger than int


  • 0
    M

    Doing myPow(1 / x, -n) for INT_MIN will result in an infinite loop. Changing n's type to long long fixes this.


  • 0

    You want the problem changed just because you can't handle it? Also, how is long long any better? Doesn't that have the exact same problem, just with LONG_LONG_MIN?


Log in to reply
 

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