32/35
Part 7 of 7 · Follow-upsLearn

Palindrome Pairs can use a trie of the words reversed

Palindrome Pairs, on Airbnb's LeetCode company tag list with the trie tag (1 source), is the hard one in this family: find every pair of words whose concatenation reads the same backwards.

The trie holds the words reversed, and each word walks down it, checking whether what's left over is a palindrome. Write the slow version first, a check of every pair, then reach for the trie.