CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes302downloads
1{2    "id": 2736,3    "name": "minimum_additions_to_make_valid_string",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/minimum-additions-to-make-valid-string/",6    "date": "1680998400000",7    "task_description": "Given a string `word` to which you can insert letters \"a\", \"b\" or \"c\" anywhere and any number of times, return _the minimum number of letters that must be inserted so that `word` becomes **valid**._ A string is called **valid **if it can be formed by concatenating the string \"abc\" several times. **Example 1:** ``` **Input:** word = \"b\" **Output:** 2 **Explanation:** Insert the letter \"a\" right before \"b\", and the letter \"c\" right next to \"b\" to obtain the valid string \"**a**b**c**\". ``` **Example 2:** ``` **Input:** word = \"aaa\" **Output:** 6 **Explanation:** Insert letters \"b\" and \"c\" next to each \"a\" to obtain the valid string \"a**bc**a**bc**a**bc**\". ``` **Example 3:** ``` **Input:** word = \"abc\" **Output:** 0 **Explanation:** word is already valid. No modifications are needed. ``` **Constraints:** `1 <= word.length <= 50` `word` consists of letters \"a\", \"b\" and \"c\" only.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "word = \"b\"",12            "output": "2 "13        },14        {15            "label": "Example 2",16            "input": "word = \"aaa\"",17            "output": "6 "18        },19        {20            "label": "Example 3",21            "input": "word = \"abc\"",22            "output": "0 "23        }24    ],25    "private_test_cases": [26        {27            "input": "bcbbcccbabacaacbacbababcccb",28            "output": 2729        },30        {31            "input": "aabbbbbabaacbbaccabaabccacaccbccbccccbaabcac",32            "output": 4633        },34        {35            "input": "ccaabcbc",36            "output": 737        },38        {39            "input": "bbbbbcbcbbbcabcbbbabacaabccbbbca",40            "output": 3441        },42        {43            "input": "bcbccbccababccbccbbabc",44            "output": 1745        },46        {47            "input": "bbcaccabbbcbcbbcaabcacacbbbccacabbabcbaacbbaaacaac",48            "output": 4649        },50        {51            "input": "bcaabaabacbcbacbcacacabcccacacabbbabbacbbaabcbaba",52            "output": 4153        },54        {55            "input": "ccbcbabacacbbaaaaabbcaabccbabacabacaacb",56            "output": 3957        },58        {59            "input": "bbcbbbcbbabccbaacabaccbcbcbbbbacccbbbabccbaa",60            "output": 5261        },62        {63            "input": "cabcaaaabababbcab",64            "output": 1365        }66    ],67    "haskell_template": "addMinimum :: String -> Int\naddMinimum word ",68    "ocaml_template": "let addMinimum (word: string) : int =  ",69    "scala_template": "def addMinimum(word: String): Int = { \n    \n}",70    "java_template": "public static int addMinimum(String word) {\n\n}",71    "python_template": "class Solution(object):\n    def addMinimum(self, word):\n        \"\"\"\n        :type word: str\n        :rtype: int\n        \"\"\"\n        "72}