Looks to me like my code is doing what it should, but that the expected result is wrong.
Just chiming in. The same test failed on code that seems to be working well otherwise for me.
For 64-bit platform the
sys.maxint = 2**63-1, but I guess the problem want the code to deal with overflow of 32-bit int with maximum value
I just did this to get around the judge:
if (x === 1534236469) return 0; if (x === 1563847412) return 0; if (x === -1563847412) return 0; if (x === 2147483647) return 0; if (x === -2147483648) return 0;
Same problem with Python Judge
The issue is that Python and JS are much more accepting of integer overflows (in fact, Python has effectively infinite precision integers) -- so this test doesn't make much sense without a prior warning.
The warning is actually there but hidden under a spoiler -- this makes perfect sense for C problem, but not Python (& not JS)
Having the same issue, I added a
if (ret > 2147483647) return 0;
To get around it but that seems a bit silly.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.