Input: 1534236469 Output: 9646324351 Expected: 0
This is for int 32.
However, python's size limit is much bigger
note that if you're using a 32-bit Python runtime, sys.maxint will return 2^31 - 1, However, Python will jump to 64-bit seamlessly with the long datatype.
It's correct as it is described.
In your code you have assume the max int is 2^31 - 1 and then handle it when the value exceeds the limit.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.