Challenge 1: Total Number of Words in a Trie
For your first challenge regarding tries, you'll be writing a very commonly used function, which gives you the trie word count.
We'll cover the following
Problem statement
Implement the totalWords()
function, which will find the total number of words in a trie.
Input
This is the root node of a trie.
Output
It returns the total number of words in a trie.
Sample input
keys = {"the", "a", "there", "answer", "any",
"by", "bye", "their","abc"}
Sample output
9
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.