R
a
c
e
c
a
r
[0][1][2][3][4][5][6][7]
Brute · clean + reverse
▸1clean ← lowercased alphanumerics of s2return clean == reverse(clean)
state
- cleaned"racecar"
warming up the animation
Given a string, return true if it is a palindrome considering only alphanumeric characters and ignoring case.
▸1clean ← lowercased alphanumerics of s2return clean == reverse(clean)
A string is a palindrome if it reads the same forwards and backwards, ignoring case and non-alphanumeric characters. Easiest idea: strip those out, lowercase, and compare to the reverse.