Created
June 23, 2019 00:53
-
-
Save Silva97/36d5c3fd301c093f965361d22813e924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************* | |
* Resolução do problema: https://leetcode.com/problems/reverse-integer/ | |
*********************/ | |
int aux_rev(int x, long long int rev) | |
{ | |
if(rev > INT_MAX || rev < INT_MIN) return 0; | |
if(!x) return rev; | |
return aux_rev(x/10, rev*10 + x%10); | |
} | |
int reverse(int x) | |
{ | |
return aux_rev(x, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment