Leetcode 139/140 单词拆分(回溯DFS以及动态规划)

暴力搜索,超时code 动态规划,时间复杂度O(n^2)blog   class Solution { public: bool wordBreak(string s, vector<string>& wordDict) { int n= s.size(); vector<bool> dp(n+1,false); unordered_set
相关文章
相关标签/搜索