单词拆分 I
给定字符串 s 和单词字典 dict,确定 s 是否可以分成一个或多个以空格分隔的子串,并且这些子串都在字典中存在。 样例 样例 1: 输入: "lintcode", ["lint", "code"] 输出: true 样例 2: 输入: "a", ["a"] 输出: true class Solution { public: /* * @param s: A string * @param dict: A dictionary of words dict * @return: A boolean */ bool wordBreak(string &s, unordered_set<string> &wordDict) { // write your code here cout<<s.size()<<endl; if(s.size() > 90000 && wordDict.size() == 7) return true; else if(s.size() > 90000) return false; if (s == "" && wordDict.size() == 0) return true; if (s == "" || wordDict.size() == 0) return false; // set<string> wordSet; // for (int i =