leetcode 140:单词拆分 II

使用首先使用139的动态规划来判断是否可以进行切分,之后进行回溯法进行切分 bool wordBreak1(std::string s, std::vector<std::string>& wordDict) { std::vector<int> dp(s.size()+1); dp[0]=1; for(int i=0;i<s.size()+1;i++){
相关文章
相关标签/搜索