Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
First clean the string by filtering to only lowercase alphanumeric characters. Then use two converging pointers from both ends, comparing characters inward. Return false on the first mismatch or true if all pairs match.
A palindrome reads the same forwards and backwards, so comparing symmetric positions from the outside in detects any asymmetry in at most n/2 comparisons.
Updated Feb 2026