DEV Community

Discussion on: How to reverse an integer in Python | LeetCode Practice

Collapse
 
jingxue profile image
Jing Xue

You could reverse and remove the leading zeroes in one step: str(int(str(x)[::-1])).

Collapse
 
mariamodan profile image
Maria

That's a great catch thanks for sharing!