Here is my one liner solution in Python3


#1

return “-” + str(A)[1:][::-1] if A<0 else str(A)[::-1]


#2

i tried the same …

but for the input -81328070
output is expected as -7082318
.it is not accepting -07082318


#3

Then you can do

return “-” + str(A).rstrip(‘0’)[1:][::-1] if A < 0 else str(A).rstrip(‘0’)[::-1]


#4

and how do you account for 32bit integers? there’s no validation for that.


#5

store the result as :
if A ==0 or A==1 just return 1
res = ‘-’ + str(abs(A))[::-1].lstrip(‘0’) if A<0 else str(abs(A))[::-1] .lstrip(‘0’)

then check if int(res) < -2147483648 or int(res) > 2147483647 for overflow
return 0

else return 1