FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2800,3 "name": "minimum_string_length_after_removing_substrings",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/minimum-string-length-after-removing-substrings/",6 "date": "2023-05-14 00:00:00",7 "task_description": "You are given a string `s` consisting only of **uppercase** English letters. You can apply some operations to this string where, in one operation, you can remove **any** occurrence of one of the substrings `\"AB\"` or `\"CD\"` from `s`. Return _the **minimum** possible length of the resulting string that you can obtain_. **Note** that the string concatenates after removing the substring and could produce new `\"AB\"` or `\"CD\"` substrings. **Example 1:** ``` **Input:** s = \"ABFCACDB\" **Output:** 2 **Explanation:** We can do the following operations: - Remove the substring \"ABFCACDB\", so s = \"FCACDB\". - Remove the substring \"FCACDB\", so s = \"FCAB\". - Remove the substring \"FCAB\", so s = \"FC\". So the resulting length of the string is 2. It can be shown that it is the minimum length that we can obtain. ``` **Example 2:** ``` **Input:** s = \"ACBBD\" **Output:** 5 **Explanation:** We cannot do any operations on the string so the length remains the same. ``` **Constraints:** `1 <= s.length <= 100` `s` consists only of uppercase English letters.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "s = \"ABFCACDB\"",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "s = \"ACBBD\"",17 "output": "5 "18 }19 ],20 "private_test_cases": [21 {22 "input": "YSWYFTJKQAOKKIFMPECDWLTTTHNBBDXVZKWPZPKMSDLMASHPDTCLYGNNWRIHOIYTZPAWMJZQ",23 "output": 7024 },25 {26 "input": "YNYISVNQYVTPTEGMRDVKYLQMFOTF",27 "output": 2828 },29 {30 "input": "ZQZTAMHNTPWIHNIWALGXQKILOOQXJGZVQBUNRYWSLNQTVVJOFAYOIJBXPKCDKZPSBXRZTCFFWSOZPOADZJCYJ",31 "output": 8332 },33 {34 "input": "RPSVIXXDMLSOMCXININPUSOZZATOGQRBWECXXQSTKZUZNHKIZWIVDPGGFGXNYQPMCZLMEWNY",35 "output": 7236 },37 {38 "input": "LJRZBTBNLKLPZ",39 "output": 1340 },41 {42 "input": "HTJYGETJMHWVAJHLFDOMPSOURF",43 "output": 2644 },45 {46 "input": "PWHXGCJLEAIQEHLAMEOZKELDCSLPTWRJYYSVFKWSUZIUPCHEUGVBFEFNVM",47 "output": 5848 },49 {50 "input": "NLPLSPPPYTCEOSTQZZUZNCVKAKJBBQMISVEZQIHRJKZSVAJXICLWMMF",51 "output": 5552 },53 {54 "input": "FFUDSNTHDPVWXHLQNRRXNQZMDOEPCMCMEZICPGUDBGKMZNZGSKCOPTKEAXLSQNWGYOMAXUKCSZG",55 "output": 7556 },57 {58 "input": "CRNGZMVRMIYXLBGLIKJEBZAVMXDGCXFGVAYUASJGNLMVCSV",59 "output": 4760 }61 ],62 "haskell_template": "minLength :: String -> Int\nminLength s ",63 "ocaml_template": "let minLength (s: string) : int = ",64 "scala_template": "def minLength(s: String): Int = { \n \n}",65 "java_template": "class Solution {\n public int minLength(String s) {\n \n }\n}",66 "python_template": "class Solution(object):\n def minLength(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n "67}