Algorithm
7. Reverse Integer
Doljae
2021. 4. 17. 21:44
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
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