bs + 1-dp
\n\nclass Solution {\n    public int minimumScore(String s, String t) {\n        char[] array1 = s.toCharArray();\n        char[] array2 = t.toCharArray();\n   
\n```\nclass Solution {\n    public int minimumScore(String s, String t) {\n        char[] array1 = s.toCharArray();\n        char[] array2 = t.toCharArray();\n        int n1 = array1.length, n2 = array2.length;\n        int index = 0;\n        int[] dp1 = new int[n2];\n        Arrays.fill(dp1, -1);\n        int[] dp2 = new int[n2];\n        Arrays.fill(dp2, -1);\n        for (int i = 0; i < n1 && index < n2; i++) {\n            char ch = array1[i];\n            if (array2[index] == ch) {\n                dp1[index] = i;\n                index++;\n            }\n        }\n        if (dp1[n2-1] != -1) return 0;\n        index = n2-1;\n        for (int i = n1-1; i >= 0 && index >= 0; i--) {\n            char ch = array1[i];\n            if (array2[index] == ch) {\n                dp2[index] = i;\n                index--;\n            }\n        }\n        int left = 1, right = n2;\n        int res = n2;\n        // bs? two pointer? -> bs\n        while (left < right) {\n            int mid = left + (right - left)/2;\n            if (validate(mid, dp1, dp2)) {\n                right = mid;\n            } else {\n                left = mid + 1;\n            }\n        }\n        return validate(left, dp1, dp2) ? left : right;\n    }\n    private boolean validate(int len, int[] dp1, int[] dp2) {\n        int n = dp1.length;\n        for (int i = 0; i <= n - len; i++) {\n            int left = i;\n            int right = i + len - 1;\n            if (left - 1 >= 0 && right + 1 < n) {\n                if (dp1[left-1] != -1 && dp2[right+1] != -1 && dp1[left-1] < dp2[right+1]) return true;\n            } else if (left - 1 >= 0) {\n                if (dp1[left-1] != -1) return true;\n            } else if (right + 1 < n){\n                if (dp2[right+1] != -1) return true;\n            }\n        }\n        return false;\n    }\n}\n```
['Java']