PREFIX-SUFFIX || TIME (n), SPACE (n)
\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        int n = s.length(),i=0,j=0,m = t.length();\n        vector<int> p(n,0),su(n,0);
```\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        int n = s.length(),i=0,j=0,m = t.length();\n        vector<int> p(n,0),su(n,0);\n        for(i = 0; i < n&&j<m; i++){\n            if(s[i]==t[j]){\n                j++;\n                p[i]++;\n            }\n            if(i){\n                p[i] += p[i-1];\n            }\n        }\n        j = m-1;\n        for(i = n-1; i >=0&&j>=0; i--){\n            if(s[i]==t[j]){\n                j--;\n                su[i]++;\n            }\n            if(i!=n-1){\n                su[i] += su[i+1];\n            }\n        }\n        int ans = n+10;\n        // for(auto &i: p)cout<<i<<" ";cout<<endl;\n        // for(auto &i: su)cout<<i<<" ";cout<<endl;\n        // cout<<n-su[0]<<" ";\n        for(i = 0; i < n-1; i++){\n            // cout<<n-p[i]-su[i+1]<<" ";\n            ans = min(ans,m-(p[i]+su[i+1]));\n        }\n        // cout<<n-p[n-1];\n        ans = min(ans,m-p[n-1]);\n        ans = min(ans,m-su[0]);\n        return max(ans,0);\n    }\n};\n```
['Greedy', 'C', 'Suffix Array', 'C++']