Challenge 4: Word Formation From a Vector Using Trie

This is a more advanced problem regarding tries. It shows you the efficiency of this data structure in word matching.

Problem statement

You have to implement the isFormationPossible() function, which will find whether or not a given word can be formed by combining two words from a vector.

Input

This is a vector and a query word.

Output

It 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.