Palindrome Pairs

Hard · Trie · about 35 minutes

Asked at Airbnb, Google, Amazon, Meta, Bloomberg.

Given a list of unique lowercase words, return all pairs of distinct indices [i, j] such that words[i] + words[j] is a palindrome. Return the pairs in any order.

Related guides