Palindrome interview problems

A palindrome is a word, phrase, number, or sequence that reads the same forwards and backwards — like racecar, level, or 121. Palindrome questions are among the most common coding-interview warmups because they cover two-pointer scanning, expand-around-center, and in-place linked-list reversal. Practice the problems below in Python and JavaScript, running your code against real test cases in the browser.

Palindrome interview problems

What is a palindrome string?

A palindrome string reads identically in both directions. Single characters and the empty string are palindromes by definition. Phrases can be palindromes too — A man, a plan, a canal: Panama qualifies once you ignore spaces, punctuation, and letter case.

Strict vs. ordinary palindrome

A strict palindrome must match exactly, character for character, including spaces, punctuation, and case — so "Racecar" is not a strict palindrome because the capital R does not match the trailing lowercase r. An ordinary (relaxed) palindrome first normalizes the input — keeping only alphanumeric characters and lower-casing them — which is why "A man, a plan, a canal: Panama" counts. Most interview prompts, including our Palindrome String problem, ask for the ordinary version, so read the prompt carefully to see which normalization rules apply.

FAQ

See also: