Can we give different language different "overflow" boundary?

  • 9

    In official and most of people's solution, C++ or Java is used. So check 2147483647 in the code is necessary. But 2147483647 is not the boundary in Python. So in Python code, adding

        if (result >= 2147483647):
            return 0

    is sort of ugly and just for AC.

    Can we have different boundary for Python in this case?

  • 2
    if result >= 2147483647 or result <= -2147483648:
            return 0

Log in to reply

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