Skip to content

Instantly share code, notes, and snippets.

@kazoo04
Created January 10, 2014 16:55
Show Gist options
  • Save kazoo04/8357994 to your computer and use it in GitHub Desktop.
Save kazoo04/8357994 to your computer and use it in GitHub Desktop.
Next Palindrome
package io.github.kazoo04.palindrome
import scala.annotation.tailrec
object NextPalindrome {
@tailrec
def next(num: Int): Int = {
val n = num + 1
if(n.toString == n.toString.reverse) {
return n
}
next(n)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment