Split a string to a string of valid words using Dynamic Programming

后端 未结 6 1203
不知归路
不知归路 2020-12-23 15:02

I need to find a dynamic programming algorithm to solve this problem. I tried but couldn\'t figure it out. Here is the problem:

You are given a string of n character

6条回答
  •  别那么骄傲
    2020-12-23 15:41

    The O(N^2) Dp is clear but if you know the words of the dictionary, i think you can use some precomputations to get it even faster in O(N). Aho-Corasick

提交回复
热议问题