EFFICIENT SOLUTION NEEDED

Правка en1, от 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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский javacoder1 2017-03-16 18:29:15 489 Initial revision (published)