Dsa
Trie
Warm-up
Trie Architecture
To estimate memory usage, you need to count how many nodes a Trie will contain (excluding the root) after inserting a list of words. Every unique prefix character path creates exactly one node.
Input Format:
1. An integer N.
2. N words.
Output Format:
A single integer representing the total number of nodes in the Trie.
Example:
Input:
2
car
cat
Output:
4
(Nodes: 'c', 'ca', 'car', 'cat')
Key concepts
triedata-structurecounting
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