Problem in the testcase


For the input: "5121478262 8070067M75 X199R 547 8C0A11 93I630 4P4071 029W433619 M3 5 14703818 776366059B9O43393’.
My code code outputs: 5121478262
But the correct answer is provided as: 2147483647.
The test cases are messed up badly


The test cases have no flaw.
It was mentioned in the question that, if the number is >INT_MAX return INT_MAX and similarly return INT_MIN.
Hope this clears your doubt.


They have assumed that for every language the INT_MAX is 2**(31)-1 and INT_MIN is -2**(31). I was stuck at this part for an hour. For python INT_MAX has different value.