Skip to content

Instantly share code, notes, and snippets.

@toantran-ea
Created January 8, 2020 12:12
Show Gist options
  • Save toantran-ea/5e5bf973503d21e07aa1622f4a49f264 to your computer and use it in GitHub Desktop.
Save toantran-ea/5e5bf973503d21e07aa1622f4a49f264 to your computer and use it in GitHub Desktop.
Imperative way of solving Reachable Number Problem
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