Skip to content

Instantly share code, notes, and snippets.

@ruan4261
Last active April 15, 2021 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruan4261/6ce164c7763f37b548c29293102f5d6b to your computer and use it in GitHub Desktop.
Save ruan4261/6ce164c7763f37b548c29293102f5d6b to your computer and use it in GitHub Desktop.
public int rev(int x) {
int res = 0;
while (x > 0) {
int mod = x % 10;
x /= 10;
res = res * 10 + mod;
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment