Reversed Digits

Given an integer n, which may be positive or negative, reverse the order of its digits while keeping the original sign. Any leading zeros that appear after reversing are dropped. Return the new integer.

Примеры

Ввод
12345
Вывод
54321
Ввод
-123
Вывод
-321
Ввод
120
Вывод
21

Нужно реализовать

def reverse_integer(n: int) -> int:

Теги

math
PostgreSQLv16

Your code output will appear here

Visible tests
1
Input
12345
Expected54321
2
Input
-123
Expected-321
3
Input
120
Expected21
4
Input
240
Expected42
5
Input
-12345
Expected-54321
6
Input
100
Expected1
Focus radio
Paused · SomaFM · Fluid