CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
meta.json117 linesDownload Raw Back to count_of_integers
1{2    "id": 2757,3    "name": "count_of_integers",4    "difficulty": "Hard",5    "link": "https://leetcode.com/problems/count-of-integers/",6    "date": "2023-05-28 00:00:00",7    "task_description": "You are given two numeric strings `num1` and `num2` and two integers `max_sum` and `min_sum`. We denote an integer `x` to be _good_ if: `num1 <= x <= num2` `min_sum <= digit_sum(x) <= max_sum`. Return _the number of good integers_. Since the answer may be large, return it modulo `109 + 7`. Note that `digit_sum(x)` denotes the sum of the digits of `x`. **Example 1:** ``` **Input:** num1 = \"1\", num2 = \"12\", `min_sum` = 1, max_sum = 8 **Output:** 11 **Explanation:** There are 11 integers whose sum of digits lies between 1 and 8 are 1,2,3,4,5,6,7,8,10,11, and 12. Thus, we return 11. ``` **Example 2:** ``` **Input:** num1 = \"1\", num2 = \"5\", `min_sum` = 1, max_sum = 5 **Output:** 5 **Explanation:** The 5 integers whose sum of digits lies between 1 and 5 are 1,2,3,4, and 5. Thus, we return 5. ``` **Constraints:** `1 <= num1 <= num2 <= 1022` `1 <= min_sum <= max_sum <= 400`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "num1 = \"1\", num2 = \"12\", min_sum = 1, max_sum = 8",12            "output": "11 "13        },14        {15            "label": "Example 2",16            "input": "num1 = \"1\", num2 = \"5\", min_sum = 1, max_sum = 5",17            "output": "5 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                "\"126410\"",24                "\"68004\"",25                28,26                9027            ],28            "output": 99998484329        },30        {31            "input": [32                "\"70788219\"",33                "\"735608042020725\"",34                76,35                12236            ],37            "output": 26833192038        },39        {40            "input": [41                "\"13854786611240\"",42                "\"74631543823139294\"",43                178,44                25145            ],46            "output": 047        },48        {49            "input": [50                "\"752257302325756851124\"",51                "\"87953611418\"",52                274,53                32654            ],55            "output": 056        },57        {58            "input": [59                "\"11013578\"",60                "\"46478259940\"",61                381,62                39863            ],64            "output": 065        },66        {67            "input": [68                "\"3955\"",69                "\"4\"",70                134,71                26372            ],73            "output": 074        },75        {76            "input": [77                "\"51286370814039\"",78                "\"68398271\"",79                193,80                21281            ],82            "output": 083        },84        {85            "input": [86                "\"78259693959833\"",87                "\"9137118286956653366\"",88                14,89                8390            ],91            "output": 88727080292        },93        {94            "input": [95                "61449294",96                "792166979",97                330,98                37199            ],100            "output": 0101        },102        {103            "input": [104                "411872784492701999",105                "5190287252047163546",106                222,107                332108            ],109            "output": 0110        }111    ],112    "haskell_template": "count :: String -> String -> Int -> Int -> Int\ncount num1 num2 min_sum max_sum ",113    "ocaml_template": "let count (num1: string) (num2: string) (min_sum: int) (max_sum: int) : int =  ",114    "scala_template": "def count(num1: String,num2: String,min_sum: Int,max_sum: Int): Int = { \n    \n}",115    "java_template": "class Solution {\n    public int count(String num1, String num2, int min_sum, int max_sum) {\n        \n    }\n}",116    "python_template": "class Solution(object):\n    def count(self, num1, num2, min_sum, max_sum):\n        \"\"\"\n        :type num1: str\n        :type num2: str\n        :type min_sum: int\n        :type max_sum: int\n        :rtype: int\n        \"\"\"\n        "117}