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 vector 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"}

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.