FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2701,3 "name": "subsequence-with-the-minimum-score",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/subsequence-with-the-minimum-score/",6 "date": "2023-02-05",7 "task_description": "You are given two strings `s` and `t`. You are allowed to remove any number of characters from the string `t`. The score of the string is `0` if no characters are removed from the string `t`, otherwise: Let `left` be the minimum index among all removed characters. Let `right` be the maximum index among all removed characters. Then the score of the string is `right - left + 1`. Return _the minimum possible score to make _`t`_ a subsequence of _`s`_._ A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., `\"ace\"` is a subsequence of `\"abcde\"` while `\"aec\"` is not). **Example 1:** ``` **Input:** s = \"abacaba\", t = \"bzaa\" **Output:** 1 **Explanation:** In this example, we remove the character \"z\" at index 1 (0-indexed). The string t becomes \"baa\" which is a subsequence of the string \"abacaba\" and the score is 1 - 1 + 1 = 1. It can be proven that 1 is the minimum score that we can achieve. ``` **Example 2:** ``` **Input:** s = \"cde\", t = \"xyz\" **Output:** 3 **Explanation:** In this example, we remove characters \"x\", \"y\" and \"z\" at indices 0, 1, and 2 (0-indexed). The string t becomes \"\" which is a subsequence of the string \"cde\" and the score is 2 - 0 + 1 = 3. It can be proven that 3 is the minimum score that we can achieve. ``` **Constraints:** `1 <= s.length, t.length <= 105` `s` and `t` consist of only lowercase English letters.",8 "test_case": [9 {10 "label": "Example 1",11 "input": "s = \"abacaba\", t = \"bzaa\"",12 "output": "1 "13 },14 {15 "label": "Example 2",16 "input": "s = \"cde\", t = \"xyz\"",17 "output": "3 "18 }19 ],20 "constraints": [21 "Let left be the minimum index among all removed characters.",22 "Let right be the maximum index among all removed characters.",23 "1 <= s.length, t.length <= 105",24 "s and t consist of only lowercase English letters."25 ],26 "python_template": "class Solution(object):\n def minimumScore(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: int\n \"\"\"\n ",27 "java_template": "class Solution {\n public int minimumScore(String s, String t) {\n \n }\n}",28 "metadata": {29 "func_name": "minimumScore"30 }31}