Simple C++ solution using  two pointers
Complexity\n- Time complexity: O(N)\n\n- Space complexity: O(M)\n\n# Code\n\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        int 
# Complexity\n- Time complexity: O(N)\n\n- Space complexity: O(M)\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        int n=s.size();\n        int m=t.size();\n        vector<int> pref(m, n);\n        vector<int> suff(m, -1);\n        for(int i=0, j=0; i<s.size() && j<t.size(); i++)\n        {\n            if(s[i]==t[j])\n                pref[j++]=i;\n        }\n\n        for(int i=s.size()-1, j=t.size()-1; i>=0 && j>=0; i--)\n        {\n            if(s[i]==t[j])\n                suff[j--]=i;\n        }\n        \n        \n        if(pref.back()!=n)\n            return 0;\n\n        int tot=t.size();\n        \n        int pos=0;\n        for(int i=0; i<m; i++)\n        {\n            if(pref[i]==n)\n                break;\n            \n            while(pos<m && suff[pos]<=pref[i])\n                pos++;\n            \n            tot=min(tot, pos-i-1);\n        }\n        for(int i=m-1; i>=0; i--)\n        {\n            if(suff[i]!=-1)\n                tot=min(tot, i);\n        }\n        return tot;\n    }\n};\n\n\n\n```
['Two Pointers', 'String', 'C++']