Challenge: Total Number of Words in a Trie

For your first challenge regarding tries, you'll be writing a very commonly used function, which gives us the trie word count.

Problem Statement #

Implement the totalWords() function, which will find the total number of words in a trie.

Input #

The root node of a trie.

Output #

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 70+ hands-on prep courses.