Challenge: Word Formation From a Dictionary Using Trie

This is a word matching problem regarding tries.

Problem Statement

You have to implement the is_formation_possible() function which will find whether a given word can be formed by combining two words from a dictionary. We assume that all words are in lower case.

Input

A dictionary and a query word containing lowercase characters.

Output

Returns True if the given word can be generated by combining two words from the dictionary.

Sample Input

dictionary = ["the", "hello", "there", "answer", "any", "by", "world", "their", "abc"]
word = "helloworld"

Sample Output

True

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