Minimum Number of Substrings From a String Needed to Piece Together Another String

Правка en1, от vamaddur, 2017-07-11 10:36:28

Given two non-empty strings A and B composed of lowercase Latin letters, what is the minimum number of substrings of A needed to form string B? The lengths of A and B are at most 100000. If the task is not possible for a given input, output a rogue value.

I was thinking about solving this with an O(N^2) DP, but that does not fit into the time limit of 5 seconds.

Please help, and thanks in advance!

Теги #strings, dynamic programming

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский vamaddur 2017-07-11 17:30:06 7 Tiny change: ' O(N^2) DP, but that' -> ' O(N^2) DP method, but that'
en4 Английский vamaddur 2017-07-11 11:20:55 6
en3 Английский vamaddur 2017-07-11 11:19:40 6
en2 Английский vamaddur 2017-07-11 11:18:52 371
en1 Английский vamaddur 2017-07-11 10:36:28 500 Initial revision (published)