One python test case is wrong


  • 1
    H
    Input:	1534236469
    Output:	9646324351
    Expected:	0
    

    This is for int 32.

    However, python's size limit is much bigger

    sys.maxint
    9223372036854775807

    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.


  • 0
    S

    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.


  • 0
    H

    this does not make sense:)


  • 0
    M

    thanks for the pointer - that was the test I was failing on too . I changed the sysmax and used it as a check before returning. It works now .

    new_sysmax = int(math.pow(2,31)-1)


  • 0
    Y

    maybe this problem is just not designed for a Python user...


Log in to reply
 

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