Created
January 31, 2022 21:20
-
-
Save mertceyhan/5ab206bc9f69f22dad26fd594fd06259 to your computer and use it in GitHub Desktop.
Answer of classic palindrome question with Kotlin
This file contains hidden or 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
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