Apple interview question

Code: A function to detect a palindrome