Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saisgit/6b492d7d7c6606884b85057d596d101b to your computer and use it in GitHub Desktop.
Save saisgit/6b492d7d7c6606884b85057d596d101b to your computer and use it in GitHub Desktop.
object reverseString extends App {
val s = "24Tutorials"
print(revs(s))
def revs(s: String): String = {
// if (s.isEmpty) ""
if (s.length == 1)  s
else revs(s.tail) + s.head
//else revs(s.substring(1)) + s.charAt(0)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment