Palindrome test 2026-10-20
Decide whether a finite string is a palindrome by comparing corresponding symbols from opposite ends. The test needs at most half as many symbol comparisons as the string length and can use constant auxiliary space.
It tests whether the input string is a palindrome: reversing the characters leaves the string unchanged. Comparisons are case-sensitive and include spaces and punctuation. For example,
mystery1("level") returns True, whereas mystery1("lever") returns False.