Challenge: Word Formation Using a Hash Table
We solved this problem using tries. Now, let's try it out with hash tables.
We'll cover the following
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 list and a query word containing lowercase characters.
Output #
Returns True
if the given word can be generated by combining two words from the list.
Sample Input #
lst = ["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.