Created
January 8, 2020 12:12
-
-
Save toantran-ea/5e5bf973503d21e07aa1622f4a49f264 to your computer and use it in GitHub Desktop.
Imperative way of solving Reachable Number Problem
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
fun f(x: Int): Int { | |
var cur = x + 1 | |
while (cur % 10 == 0) cur /= 10 | |
return cur | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment