Challenge: Find All Words Stored in Trie
Explore how to implement a function that extracts all words stored in a trie data structure. Understand how to traverse the trie efficiently to gather complete words, improving your skills in string manipulation and trie operations in JavaScript.
We'll cover the following...
We'll cover the following...
Statement
Given a trie data structure representing a list of words, implement a function that finds and returns all words stored in the trie.
Constraints:
words.lengthwords[i].lengthAll
words[i]consist of lowercase English letters.
Examples
1 / 3
Try it yourself
Implement your solution in solution.js in the following coding playground.
JavaScript
usercode > solution.js
import {TrieNode} from './TrieNode.js';import {Trie} from './Trie.js';function findWords(root) {let result = [];// Replace this placeholder return statement with your codereturn result;}export {findWords}
Click "Run" to evaluate your code.
Find All Words Stored in Trie