Algorithms Playbook
← All problems
EasyTwo pointers →Similar to: Valid Palindrome

Reads the same both ways

Problem

A phrase is a palindrome if, after lowercasing it and removing every character that isn't a letter or a digit, it reads the same forwards and backwards. Given a string s, return whether it is a palindrome.

Examples

Input: "A man, a plan, a canal: Panama"

Output: true

Input: "race a car"

Output: false

Hints

    Try it first. Every hint reveals a bit more.

    Solution