What a palindrome is
A palindrome is a word, number or phrase that reads exactly the same from left to right as it does from right to left. The simplest example is a word like racecar: write it backwards and you get the same sequence of letters. The term comes from the Greek palindromos, meaning "running back again".
How a palindrome is checked
Comparing the text as-is would give false negatives, because spaces, capitalization and punctuation do not count in a phrase palindrome. So we first normalize: lowercase everything, strip accents (é becomes e), and remove anything that is not a letter or a digit. Only then do we compare the resulting string with its reversed version. If they are identical, it is a palindrome.
- Lowercase: "Racecar" and "racecar" are treated the same.
- No accents: accented characters are reduced to their base letter.
- Alphanumeric only: spaces, commas and symbols are discarded.
- Comparison: the normalized string must equal its reverse.
Types of palindromes
- Word: a single palindromic word, such as radar, level or racecar.
- Phrase: several words that together form a palindrome, like A man a plan a canal Panama.
- Numeric: numbers that read the same both ways, like 12321 or 1001.
- Date: dates that come out palindromic depending on the format, a classic bit of trivia.
Famous palindromes in English
English has plenty of celebrated palindromes prized for their cleverness. Some of the best known:
| Type | Example |
|---|---|
| Word | racecar |
| Word | level |
| Phrase | A man a plan a canal Panama |
| Phrase | Was it a car or a cat I saw |
| Phrase | Never odd or even |
| Number | 12321 |
Palindromes in programming and interviews
"Check whether a string is a palindrome" is one of the most common technical interview exercises. The idea is exactly what we do here: normalize the string and compare it with its reverse, or walk it with two pointers (one at the start, one at the end) moving toward the center. It is an ideal problem for practicing string handling, O(n) time complexity, and edge cases like empty strings, mixed case and non-letter characters.