Challenge: Total Number of Words in a Trie

For your first challenge regarding tries, you'll be writing a 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

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy