|Palindrome Check
All Challenges

Palindrome Check

EasyStrings

Given a string s, return True if it is a palindrome, False otherwise.


A palindrome reads the same forwards and backwards. For this problem:

- Ignore spaces and punctuation

- Treat uppercase and lowercase as the same


Real use case: input validation — checking if a user typed something symmetric (like a username or code token).

Examples

Input: is_palindrome("racecar")
Output: True
Same forwards and back
Input: is_palindrome("hello")
Output: False
"olleh" != "hello"
Input: is_palindrome("A man a plan a canal Panama")
Output: True
Ignore spaces, case-insensitive
Input: is_palindrome("")
Output: True
Empty string is a palindrome

Constraints

  • 0 <= len(s) <= 10,000
  • Only consider alphanumeric characters
pythoneditor
Loading Python runtime…