Cpp Solution easy to understand
\n# Code\n\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        \n        vector<int>v;\n        int ans=0;\n        \n        int i=
\n# Code\n```\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        \n        vector<int>v;\n        int ans=0;\n        \n        int i=s.size()-1,j=t.size()-1;\n        \n        while(i>=0 && j>=0){\n            if(s[i]==t[j]){v.push_back(i);j--;}\n            i--;\n        }\n        \n        reverse(v.begin(),v.end());\n        \n        ans=t.size()-v.size();\n        \n        if(ans==0)return ans;\n        \n        i=0,j=0;\n        \n                \n        while(j<t.size()){\n            while(i<s.size() && s[i]!=t[j])i++;\n            if(i>=s.size())break;\n            int u=upper_bound(v.begin(),v.end(),i)-v.begin();\n            \n      \n            int m=v.size(),p=t.size();\n            \n            if(u>=m)ans=min(ans,p-(j+1));\n        \n            else ans=min(ans,p-(m-u)-(j+1));\n            \n            j++;\n            i++;\n        }\n        \n        \n        return ans;\n    }\n};\n\n\n```
['C++']