題目找出是否是另一個字串的子字串。 解題方法就是用find去找,然後每找到一次就從那個位置+1繼續找。想不到吧! 程式碼1234567891011121314class Solution {public: bool isSubsequence(string s, string t) { int count = 0; for(int i=0;i<s.length();i++) { int tmp = t.find(s[i],count); if(tmp == t.npos) return false; count = tmp+1; } return true; }};