CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes564downloads
meta.json47 linesDownload Raw Back to clear_digits
1{2    "id": 3447,3    "name": "clear_digits",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/clear-digits/",6    "date": "2024-05-25 00:00:00",7    "task_description": "You are given a string `s`. Your task is to remove **all** digits by doing this operation repeatedly: Delete the _first_ digit and the **closest** non-digit character to its _left_. Return the resulting string after removing all digits. **Note** that the operation _cannot_ be performed on a digit that does not have any non-digit character to its left. **Example 1:** **Input:** s = \"abc\" **Output:** \"abc\" **Explanation:** There is no digit in the string. **Example 2:** **Input:** s = \"cb34\" **Output:** \"\" **Explanation:** First, we apply the operation on `s[2]`, and `s` becomes `\"c4\"`. Then we apply the operation on `s[1]`, and `s` becomes `\"\"`. **Constraints:** `1 <= s.length <= 100` `s` consists only of lowercase English letters and digits. The input is generated such that it is possible to delete all digits.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "s = \"abc\"",12            "output": "\"abc\" "13        },14        {15            "label": "Example 2",16            "input": "s = \"cb34\"",17            "output": "\"\" "18        }19    ],20    "private_test_cases": [21        {22            "input": "zkjf6chmfz72qgdpdyzty389j8dh",23            "output": "zkjchmqgdpdydh"24        },25        {26            "input": "anar1l9tiiyl4pgt24zhc7qt7ixv4fetd9je34r5w8xsvb7yl7xvd78mayqqgy93jkwk5j2s2wwam7a0hkqsd",27            "output": "anatiiypzhqixfetxsvyxmayqqjkwwwahkqsd"28        },29        {30            "input": "ies3kufsimsq5x6ilfx1mf2u16f7hikc6lmf7cptlvd4bdv82x62rwm2",31            "output": "iekufsimsilfhiklmcptlvrw"32        },33        {34            "input": "5nq7mkio3abr9hx6y98dj965uhq55ehhen9f9xlgfnrkosl7i5xnse0ezbodlmjdsleucs",35            "output": "mkiauehhexlgfnrkosxnsezbodlmjdsleucn"36        },37        {38            "input": "9j9mihoo9i0083t0ew7b2onsmd6zv974js4uuhvtca5taauie6f6mpllei3uuvstb9qnap7reomimrh7n03",39            "output": "eonsjuuhvtctaauimplleuuvstqnareomimrm"40        }41    ],42    "haskell_template": "clearDigits :: String -> String\nclearDigits s ",43    "ocaml_template": "let clearDigits (s: string) : string =  ",44    "scala_template": "def clearDigits(s: String): String = { \n    \n}",45    "java_template": "class Solution {\n    public String clearDigits(String s) {\n        \n    }\n}",46    "python_template": "class Solution(object):\n    def clearDigits(self, s):\n        \"\"\"\n        :type s: str\n        :rtype: str\n        \"\"\"\n        "47}