Solution to Reverse Integer by LeetCode

27 Mar

Question: http://oj.leetcode.com/problems/reverse-integer/

Question Name: Reverse Integer

Python is an overwhelmingly excellent choice to solve this question, right? Firstly, this is a non-recursive solution:

 We also provide a recursive solution as following:

UPDATE: challenge updated to test the overflow behavior.

2 thoughts on “Solution to Reverse Integer by LeetCode

  1. The problem has been updated such that the overflow cases should be considered:

    Update (2014-11-10):
    Test cases had been added to test the overflow behavior.

    An updated solution would be:

Leave a Reply

Your email address will not be published. Required fields are marked *