We also use DP to solve the problem. In this solution, A[i] is not a boolLeetcode#139 Word Break 原题地址 与Word Break II(参见这篇文章)相比,只需要判断是否可行,不需要构造解,简单一些. 依然是动态规划. 代码: bool wordBreak(string s, unordered_set<string> &dict) { ; for (auto w :...