Skip to content
Snippets Groups Projects
Commit 151095d7 authored by Ezio Giraldi's avatar Ezio Giraldi
Browse files

Swift_Q1

parent 8885df00
No related branches found
No related tags found
No related merge requests found
/// Returns whether or not the given text is a palindrome.
func isPalindrome(_ text: String) -> Bool {
// Write your code here.
//
// - Hint:
// Check the official documentation on Swift.String to see how to manipulate string
// indices (https://developer.apple.com/documentation/swift/string).
if ( String(text.reversed()) == text ) {
return true;
}
fatalError("not implemented")
else {
return false;
}
}
......@@ -15,3 +14,4 @@ for string in ["kayak", "koala"] {
let isStringAPalindrome = isPalindrome(string)
print("'\(string)' is \(isStringAPalindrome ? "" : "not ")a palindrome")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment