Two pointers
Observations:\n1. By the way we calculaute the score, it makes no difference to assume that any points in between [left, right] are removed. \n2. Because we do 
Observations:\n1. By the way we calculaute the score, it makes no difference to assume that any points in between [left, right] are removed. \n2. Because we do not need to remove (right end inclusive) t[0, left - 1] and t[right + 1, t.size() - 1],  they have to be subsequences of s.\n3. This means, we want to remove the shortest substring of t so that prefix and suffix strings of t are both subsequences of s. The score of the removal is the number of characters removed.\n4. Finally, the idea of solving the question is: We first find the longest prefix substring of t which is also a subsequence of s. Then we gradually increase the length of the suffix string to get the maximal characters removed in each settings. Time and space complexity are both linear in the lengths\n```\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        int m = s.size(), n = t.size();\n        vector<int> stk;\n        for(int i = 0, j = 0; i < m; i++){\n            if(s[i] != t[j]) continue;\n            stk.push_back(i);\n            j++;\n        }\n        \n        int res = n - stk.size();\n        if(res == 0) return res;\n        \n        for(int i = m - 1, j = n - 1; i >= 0; i--){\n            if(s[i] != t[j]) continue;\n            while(!stk.empty() && stk.back() >= i){\n                stk.pop_back();\n            }\n            j--;\n            res = min(res, j - (int)stk.size() + 1);\n        }\n        return res;\n    }\n};\n```
[]