Created
April 26, 2022 16:05
-
-
Save BalajiMalliswamy/0e5596d6d2149949de65ef963b977012 to your computer and use it in GitHub Desktop.
Given the string, check if it is a palindrome.
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
//Given the string, check if it is a palindrome. | |
//Example | |
// For inputString = "aabaa", the output should be | |
// solution(inputString) = true; | |
// For inputString = "abac", the output should be | |
// solution(inputString) = false; | |
// For inputString = "a", the output should be | |
// solution(inputString) = true. | |
func solution(inputString: String) -> Bool { | |
return inputString == String(inputString.reversed()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment