ByteByteGo logo
menuProblems List

Is Palindrome Valid

Easy

A palindrome is a sequence of characters that reads the same forward and backward.

Given a string, determine if it's a palindrome after removing all non-alphanumeric characters. A character is alphanumeric if it's either a letter or a number.

Example 1:

Input: s = 'a dog! a panic in a pagoda.'
Output: True

Example 2:

Input: s = 'abc123'
Output: False

Constraints:

  • The string may include a combination of lowercase English letters, numbers, spaces, and punctuations.

You can practice coding exercises online by logging into bytebytego.com on your laptop.