2486. Append Characters to String to Make Subsequence 發表於 2023-02-13 | 分類於 leetcode problemsolution1234567891011121314class Solution {public: int appendCharacters(string s, string t) { int l =0, r = 0, n =s.size(), m= t.size(); while(l<n && r<m) { if(s[l] == t[r]){ l++;r++; } else l++; } return m-r; }}; analysis time complexity O(n) space complexity O(1)