Comments + Video Solution || prefix - Suffix || O(N) complexity|| C++ Solution
\n\n# Approach\nJust construct the prefix and suffix array based on no of subsequence matching characters and then just see how many characters are matching fro
\n\n# Approach\nJust construct the prefix and suffix array based on no of subsequence matching characters and then just see how many characters are matching from left and how many are matching from right. Then take the unmatched part for every index and return the minimum\n\nLink : https://www.youtube.com/watch?v=eVAeTG5VjVM\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n\n    int minimumScore(string s, string t) \n    {\n        int m = s.size();\n        int n = t.size();\n\n        int mini = 1e9;\n        vector<int>pref(m, 0), suff(m, 0);\n\n        int j = 0;\n        for(int i=0; i<m && j<n; i++)\n        {\n            if(s[i] == t[j])\n            {\n                pref[i]++;\n                j++;\n            }\n\n            if(i>0) pref[i] += pref[i-1];\n        }\n\n        j=n-1;\n        for(int i=m-1; i>=0 && j>=0; i--)\n        {\n            if(s[i] == t[j])\n            {\n                suff[i]++;\n                j--;\n            }\n\n            if(i<m-1) suff[i] += suff[i+1];\n        }\n\n        for(int i=0; i<m-1; i++)\n        {\n            mini = min(mini, n-(pref[i]+suff[i+1]));\n        }\n\n        mini = min(mini, n-(pref[m-1]));\n        mini = min(mini, n-(suff[0]));\n\n        return max(mini, 0);\n    }\n};\n```
['C++']