Reverse the Digits

Sometimes you need to work with a number digit by digit while still respecting its sign and integer limits. Given a 32-bit signed integer x, return the number with its digits reversed. If the reversed value is outside the range from -2**31 to 2**31 - 1, return 0.

Примеры

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

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

def reverse_integer(x: int) -> int:

Теги

math
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

Visible tests
1
Input
123
Expected321
2
Input
-123
Expected-321
3
Input
120
Expected21
4
Input
0
Expected0
5
Input
1534236469
Expected0
6
Input
100
Expected1
Focus radio
Paused · SomaFM · Fluid