Skip to content

Instantly share code, notes, and snippets.

@mertceyhan
Created January 31, 2022 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mertceyhan/5ab206bc9f69f22dad26fd594fd06259 to your computer and use it in GitHub Desktop.
Save mertceyhan/5ab206bc9f69f22dad26fd594fd06259 to your computer and use it in GitHub Desktop.
Answer of classic palindrome question with Kotlin
object PalindromeDetector {
fun isPalindrome(text: String): Boolean {
val content = text.toCharArray()
val reversedContent = content.reversedArray()
return content.concatToString() == reversedContent.concatToString()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment