Let's say you have a phrase without any spaces eg. "thisisawesome".

Let's say you have a phrase without any spaces - eg. "thisisawesome". Given a dictionary, how would you add spaces in this string?

我的理解是:把这个字符串用空格拆成字符 "this" "is" "awesome",这三个字符应该都能够在字典里面找到。

比如,还可以这样拆"thisi" "saw" "esome", 这里我假设这这样三个单词也能够在字典里找到,那么,这样的拆法,也是满足条件的。

现在是要求一个算法,把结果全部找出来。

原文地址:https://www.cnblogs.com/yayagamer/p/2253275.html