Last active
April 15, 2021 08:52
-
-
Save ruan4261/6ce164c7763f37b548c29293102f5d6b 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
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