It's working for large integers also but something's wrong. Help please!


#1

def reverse(self, A):
B=abs(A)
B=str(B)
C = B.strip(“0”)
C=list©
C.reverse()
C= “”.join©
if A<0:
return int("-"+C)
return int©

Your submission failed for the following input:
A : -1146467285

Your function returned the following :
-5827646411

The expected returned value :
0


#2

Return 0 if the result overflows and does not fit in a 32 bit signed integer


#3

If the reversed number is >2147483648 or reversed number is <-2147483648
return 0, as mentioned in question.


#4

put your reverse value in try catch if got in catch then return 0. Best way I think to handle this error.