EFFICIENT SOLUTION NEEDED

Revision en1, by javacoder1, 2017-03-16 18:29:15

Given a list of words and q queries are given . In each query i am given a string and i have to tell which strings are combination of two or more words from the initial given words. I am solve this if each word is a combination of two mords using hashing and extend it to more words case using dp. Does there exists a better solution somewhat linear in the number of words using some advanced data structure?

eg.

a

b

c

1

abc

Output

yes

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English javacoder1 2017-03-16 18:29:15 489 Initial revision (published)