[LeetCode]#2119. A Number After a Double Reversal

Input: num = 526
Output: true
Explanation: Reverse num to get 625, then reverse 625 to get 526, which equals num.
class Solution:
def isSameAfterReversals(self, num):
temp=str(num)
temp=int(temp[::-1])
temp=str(temp)
temp=temp[::-1]
if int(temp) ==num:
return True
else:
return False

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store