Question bank › Trie
Dsa Trie Easy

Distinct Prefix Count

Given a list of words, calculate how many distinct prefixes exist among them. The first line contains an integer n followed by n words. The output should be the number of distinct prefixes. Example Input: 5 apple apricot banana band bandana Example Output: 12

Key concepts

trieprefixset

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.