Challenge: Find All Words Stored in Trie

If you are given a trie, can you return every word it contains?

Problem Statement #

You have to implement the findWords() function which will return all the words stored in Trie.

Input #

The root node of a trie.

Output: #

A list of all the words stored in a trie.

Sample Input #

keys = ["the", "a", "there", "answer", "any",
                     "by", "bye", "their","abc"]

Sample Output #

["a", "abc", "answer", "any", "by", "bye", "the", "their", "there"]

Create a free account to view this lesson.

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