class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ if x<0: flag=False x=-x else: flag=True r=0 while x>0: tail=x%10 r=r*10+tail x=x/10 if not flag: r=-r return r
when I submit my answer, the result is:
-- why 0 is expected??? confused...
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.