CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 2921,3    "name": "count_stepping_numbers_in_range",4    "difficulty": "Hard",5    "link": "https://leetcode.com/problems/count-stepping-numbers-in-range/",6    "date": "1690070400000",7    "task_description": "Given two positive integers `low` and `high` represented as strings, find the count of **stepping numbers** in the inclusive range `[low, high]`. A **stepping number** is an integer such that all of its adjacent digits have an absolute difference of **exactly** `1`. Return _an integer denoting the count of stepping numbers in the inclusive range_ `[low, high]`_. _ Since the answer may be very large, return it **modulo** `109 + 7`. **Note:** A stepping number should not have a leading zero. **Example 1:** ``` **Input:** low = \"1\", high = \"11\" **Output:** 10 **Explanation: **The stepping numbers in the range [1,11] are 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. There are a total of 10 stepping numbers in the range. Hence, the output is 10. ``` **Example 2:** ``` **Input:** low = \"90\", high = \"101\" **Output:** 2 **Explanation: **The stepping numbers in the range [90,101] are 98 and 101. There are a total of 2 stepping numbers in the range. Hence, the output is 2. ``` **Constraints:** `1 <= int(low) <= int(high) < 10100` `1 <= low.length, high.length <= 100` `low` and `high` consist of only digits. `low` and `high` don't have any leading zeros.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "low = \"1\", high = \"11\"",12            "output": "10 "13        },14        {15            "label": "Example 2",16            "input": "low = \"90\", high = \"101\"",17            "output": "2 "18        }19    ],20    "private_test_cases": [],21    "haskell_template": "countSteppingNumbers :: String -> String -> Int\ncountSteppingNumbers low high ",22    "ocaml_template": "let countSteppingNumbers (low: string) (high: string) : int =  ",23    "scala_template": "def countSteppingNumbers(low: String,high: String): Int = { \n    \n}",24    "java_template": "public static int countSteppingNumbers(String low, String high) {\n\n}",25    "python_template": "class Solution(object):\n    def countSteppingNumbers(self, low, high):\n        \"\"\"\n        :type low: str\n        :type high: str\n        :rtype: int\n        \"\"\"\n        "26}