Valid Palindrome
Difficulty: Easy · Topic: Arrays & strings
Given a string s, return True if it reads the same forwards and backwards considering only alphanumeric characters and ignoring case.
Examples
is_palindrome("A man, a plan, a canal: Panama")
→ trueCleaned: 'amanaplanacanalpanama'.
is_palindrome("race a car")
→ falseTarget complexity: time O(n), space O(n)
Write your solution in Python and run it against hidden tests right on this page. Progressive hints and Python + C++ reference solutions are included.
Learn the idea first: the lesson for this problem.