CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 3172,3    "name": "divisible_and_non_divisible_sums_difference",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/divisible-and-non-divisible-sums-difference/",6    "date": "2023-10-01 00:00:00",7    "task_description": "You are given positive integers `n` and `m`. Define two integers as follows: `num1`: The sum of all integers in the range `[1, n]` (both **inclusive**) that are **not divisible** by `m`. `num2`: The sum of all integers in the range `[1, n]` (both **inclusive**) that are **divisible** by `m`. Return _the integer_ `num1 - num2`. **Example 1:** ``` **Input:** n = 10, m = 3 **Output:** 19 **Explanation:** In the given example: - Integers in the range [1, 10] that are not divisible by 3 are [1,2,4,5,7,8,10], num1 is the sum of those integers = 37. - Integers in the range [1, 10] that are divisible by 3 are [3,6,9], num2 is the sum of those integers = 18. We return 37 - 18 = 19 as the answer. ``` **Example 2:** ``` **Input:** n = 5, m = 6 **Output:** 15 **Explanation:** In the given example: - Integers in the range [1, 5] that are not divisible by 6 are [1,2,3,4,5], num1 is the sum of those integers = 15. - Integers in the range [1, 5] that are divisible by 6 are [], num2 is the sum of those integers = 0. We return 15 - 0 = 15 as the answer. ``` **Example 3:** ``` **Input:** n = 5, m = 1 **Output:** -15 **Explanation:** In the given example: - Integers in the range [1, 5] that are not divisible by 1 are [], num1 is the sum of those integers = 0. - Integers in the range [1, 5] that are divisible by 1 are [1,2,3,4,5], num2 is the sum of those integers = 15. We return 0 - 15 = -15 as the answer. ``` **Constraints:** `1 <= n, m <= 1000`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "n = 10, m = 3",12            "output": "19 "13        },14        {15            "label": "Example 2",16            "input": "n = 5, m = 6",17            "output": "15 "18        },19        {20            "label": "Example 3",21            "input": "n = 5, m = 1",22            "output": "-15 "23        }24    ],25    "private_test_cases": [26        {27            "input": [28                827,29                71330            ],31            "output": 34095232        },33        {34            "input": [35                957,36                39037            ],38            "output": 45606339        },40        {41            "input": [42                941,43                79044            ],45            "output": 44163146        },47        {48            "input": [49                224,50                25551            ],52            "output": 2520053        },54        {55            "input": [56                17,57                9958            ],59            "output": 15360        },61        {62            "input": [63                203,64                36365            ],66            "output": 2070667        },68        {69            "input": [70                151,71                97172            ],73            "output": 1147674        },75        {76            "input": [77                726,78                76279            ],80            "output": 26390181        },82        {83            "input": [84                997,85                5986            ],87            "output": 48145588        },89        {90            "input": [91                999,92                98693            ],94            "output": 49752895        }96    ],97    "haskell_template": "differenceOfSums :: Int -> Int -> Int\ndifferenceOfSums n m ",98    "ocaml_template": "let differenceOfSums (n: int) (m: int) : int =  ",99    "scala_template": "def differenceOfSums(n: Int,m: Int): Int = { \n    \n}",100    "java_template": "class Solution {\n    public int differenceOfSums(int n, int m) {\n        \n    }\n}",101    "python_template": "class Solution(object):\n    def differenceOfSums(self, n, m):\n        \"\"\"\n        :type n: int\n        :type m: int\n        :rtype: int\n        \"\"\"\n        "102}