Challenge: Word Formation From a Vector Using Trie
This is a more advanced problem regarding tries and shows us the efficiency of this data structure in word matching.
We'll cover the following
Problem Statement #
You have to implement the isFormationPossible()
function, which will find whether a given word can be formed by combining two words from a vector.
Input #
A vector and a query word.
Output #
Returns true
if the given word can be generated by combining two words from the vector.
Sample Input #
list = {"the", "hello", "there", "answer", "any", "by", "world", "their","abc"}
word = "helloworld"
Sample Output #
1 (true)
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.