7. Reverse Integer
· 약 1분
[Reverse Integer - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com](https://leetcode.com/problems/reverse-integer/)
1. 내 풀이
class Solution:
def reverse(self, x: int) -> int:
x = int(str(x)[::-1]) if str(x)[-1] != "-" else int("-" + str(x)[::-1][:-1])
return x if abs(x) < 2 ** 31 else 0
