subsequence-with-the-minimum-score - Java Solution
\n\n# Code\njava []\nclass Solution {\n    public int minimumScore(String s, String t) {\n        int m = s.length(), n = t.length();\n        int []left = new 
\n\n# Code\n```java []\nclass Solution {\n    public int minimumScore(String s, String t) {\n        int m = s.length(), n = t.length();\n        int []left = new int[n+2];\n        int []right = new int[n+2];\n        int p = 0;\n        for (int i = 0; i < n; ++i) {\n            while (p < m && s.charAt(p) != t.charAt(i)) p++;\n            left[i+1] = p++;\n        }\n        left[0] = -1;\n        p = m - 1;\n        for (int i = n - 1; i >= 0; --i) {\n            while (p >= 0 && s.charAt(p) != t.charAt(i)) p--;\n            right[i+1] = p--;\n        }\n        right[n+1] = m;\n\n        int l = 0, r = n;\n        while (l <= r) {\n            int x = (l + r) / 2;\n            boolean flag = false;\n            for (int i = 0; i + x - 1 < n; ++i) {\n                if (left[i] < right[i+x+1]) \n                    flag = true;\n            }\n            if (flag) r = x - 1;\n            else l = x + 1;\n        }\n        return l;\n    }\n}\n```
['Two Pointers', 'String', 'Binary Search', 'Java']