Challenge 2: Find All Words Stored in Trie
If you are given a trie, can you return every word it contains?
We'll cover the following
Problem statement
You have to implement the findWords()
function, which will return all the words stored in trie.
Input
This is the root node of a trie.
Output
It is 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.