Skip to content

Instantly share code, notes, and snippets.

@toliuweijing
Created July 26, 2013 00:12
Show Gist options
  • Save toliuweijing/6085028 to your computer and use it in GitHub Desktop.
Save toliuweijing/6085028 to your computer and use it in GitHub Desktop.
class Solution {
public:
int reverse(int x) {
int ret = 0;
while (x != 0) {
ret *= 10;
ret += x % 10;
x /= 10;
}
return ret;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment