C++ | BinarySearch
\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        vector<int> right(t.length(), -1);\n        vector<int> left(t.length(), -1);\n
```\nclass Solution {\npublic:\n    int minimumScore(string s, string t) {\n        vector<int> right(t.length(), -1);\n        vector<int> left(t.length(), -1);\n\n        int i = 0; \n\n        for(int j = 0 ; j < s.length(); j++) {\n            if ( i < t.length() && t[i] == s[j] ) {\n                left[i] = j;\n                i++;\n            }\n        }\n\n        i = t.size()-1;\n        for(int j = s.length()-1 ; j >= 0; j--) {\n            if ( i >= 0 && t[i] == s[j] ) {\n                right[i] = j;\n                i--;\n            }\n        }\n\n        int ans = t.size();\n        int low = 0, high = t.size();\n        while (low <= high) {\n            int mid = (low + high)/2;\n            if (isSubSequence(t, mid, left, right)) {\n                ans = mid;\n                high = mid -1;\n            } else {\n                low = mid + 1;\n            }\n        }\n        return ans;\n    }\n\n    bool isSubSequence(string &t, int val, vector<int> &left, vector<int> &right) {\n        if(val == t.length()) {\n            return true;\n        }\n\n        for(int i=0; i<=t.length()-val; i++) {\n            if (i-1>=0 && i+val < t.length()) {\n                if(left[i-1] !=-1 && right[i+val] != -1 && right[i+val] > left[i-1]) {\n                    return true;\n                }\n            } else if (i-1 >= 0) {\n                if (left[i-1] != -1) {\n                    return true;\n                }\n            } else if (i+val < t.length()) {\n                if(right[i+val] != -1) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n\n};\n\n```
['C++']