Dsa
Trie
Hard
Most Frequent Prefix
You are given a list of words. Your task is to find the most frequently occurring prefix that appears among these words. If multiple prefixes have the same frequency, return the longest one. Input format: The first line contains an integer n (1 ≤ n ≤ 1000) representing the number of words. The next n lines each contain a single word (1 ≤ length of word ≤ 100). Output format: Print the most frequent prefix. Example: Input: 5
flower
flight
flour
flow
flame
Output: fl
Key concepts
triefrequency countingprefix management
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