Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Reverse Integer by Wartem
def reverse_digits(num: int) -> int:
negative = "-" if num < 0 else ""
num = str(num)
if negative:
num = num.replace("-", "")
return int(negative + num[::-1])
Nov. 7, 2023