Dsa
Trie
Medium
Palindrome Pairs Finder
You need to find all unique pairs of words from a given list that form palindromes when concatenated. Implement this using a Trie. The input consists of an integer n, followed by n words. Your output should list all pairs of indices (i, j) such that the concatenation of words[i] + words[j] is a palindrome. Return pairs in the format i,j where i < j.
Example:
Input:
4
bat
tab
cat
racecar
Output:
0,1
1,0
3,2
2,3
Key concepts
triepalindromepair
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now