Valid Palindrome
beginnerVerifies a string reads the same forwards and backwards using the two-pointer technique.
PhaseInit
Compares0
L0
R6
L
R
r
[0]a
[1]c
[2]e
[3]c
[4]a
[5]r
[6]Unscanned character
L or R pointer position
Confirmed matching pair
Mismatch
Input: "racecar" (lowercased). Set L=0 and R=6. Pointers will march inward comparing characters.
1 / 8