Word Break(C++单词拆分)


(1)动态规划

class Solution {
public:
    bool wordBreak(string s, vector& wordDict) {
        int len=wordDict.size();
        unordered_set st;
        for(int i=0;i v(s.size()+1,false);
        v[0]=true;
        for(int i=1;i

你可能感兴趣的:(C++,LeetCode,c++,leetcode,动态规划)