Java; O(n) / O(n) 2 passes
Intuition\nI added some notes and improved readability on top of one answer.\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- 
# Intuition\nI added some notes and improved readability on top of one answer.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n\n    // First we want to convert the question to max length of prefix t matchable of prefix s[0..i] plus max length of suffix t matachable of suffix s[i+1..]\n    // because the total length of t minus the max length above is the minimal score.\n    // So we need 2 passes, first pass we can get the max length of prefix t, second pass we can get \n    // the max length of suffix t.\n    public int minimumScore(String s, String t) {\n        // preMatchCount calculates at index i, how many characters in string t[0..j]\n        // occurs in prefix of s[0..i]\n        int[] preMatchCount = new int[s.length()];\n        for (int i = 0, j = 0; i < s.length() && j <t.length(); i++) {\n            if (i > 0) {\n                // if s[i] has no match, then preMatchCount[i] is preMatchCount[i - 1]\n                // by definition\n                preMatchCount[i] = preMatchCount[i - 1];\n            }\n            // if there\'s match then we need to move index j forward\n            if (s.charAt(i) == t.charAt(j)) {\n                j++;\n                preMatchCount[i]++;\n            }\n        }\n        // sufMatchCount calculates at index i, how many characters in string t[j..]\n        // occurs in suffix of s[i..]\n        int sufMatchCount = 0;\n        // midMatchCount calculates at index i, how many characters in string t[0..j]\n        // occurs in prefix of s[0..i] plus how many characters in t[j+1 ..] occurs in \n        // suffix s[i+1..]\n        // t.length - midMatchCount is the final result.\n        int midMatchCount = 0;\n        for (int i = s.length() - 1, j = t.length() - 1; i >= 0 && j >= 0; i--) {\n            midMatchCount = Math.max(midMatchCount, sufMatchCount + preMatchCount[i]);\n            // if there\'s match then we need to move index j backward\n            if (s.charAt(i) == t.charAt(j)) {\n                j--;\n                sufMatchCount++;\n            }\n\n        }\n        // why do we want to do a max again? because midMatchCount may not be updated (the whole suffix is a match)\n        \n        return Math.max(0, t.length() - Math.max(midMatchCount, sufMatchCount));\n    }\n\n\n}\n```
['Java']