Accepted 2 lines of code. Beats 80%


  • 1
    V
    class Solution(object):
        def reverse(self, x): return (-int(str(abs(int(x)))[::-1]) if int(str(abs(int(x)))[::-1]) <= 2147483648 else 0) if int(x) < 0 else (int(str(abs(int(x)))[::-1]) if int(str(abs(int(x)))[::-1]) <= 2147483647 else 0)
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.