My Solution
\n/**\n * Time Complexity: O(n)\n * Space Complexity: O(n)\n * where `n` is the length of the string `s`\n */\nclass Solution {\n public:\n  int minimumScore(co
```\n/**\n * Time Complexity: O(n)\n * Space Complexity: O(n)\n * where `n` is the length of the string `s`\n */\nclass Solution {\n public:\n  int minimumScore(const string &s, const string &t) {\n    const int n_s = static_cast<int>(s.size());\n    const int n_t = static_cast<int>(t.size());\n    int left[n_s];\n    memset(left, 0, sizeof(left));\n    for (int length_t = 0, i_s = 0; i_s < n_s; ++i_s) {\n      if (length_t < n_t && s[i_s] == t[length_t]) {\n        ++length_t;\n      }\n      left[i_s] = length_t;\n    }\n    \n    int right[n_s];\n    memset(right, 0, sizeof(right));\n    for (int length_t = 0, i_s = n_s - 1; i_s > -1; --i_s) {\n      if (length_t < n_t && s[i_s] == t[n_t - length_t - 1]) {\n        ++length_t;\n      }\n      right[i_s] = length_t;\n    }\n    \n    int ret = n_t;\n    for (int left_length = 0; left_length < n_s + 1; ++left_length) {\n      const int l = left_length == 0 ? 0 : left[left_length - 1];\n      const int r = left_length == n_s ? 0 : right[left_length];\n      ret = min(ret, max(0, n_t - (l + r)));\n    }\n    return ret;\n  }\n};\n```
[]