CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes305downloads
1{2    "id": 2696,3    "name": "the_number_of_beautiful_subsets",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/the-number-of-beautiful-subsets/",6    "date": "1678579200000",7    "task_description": "You are given an array `nums` of positive integers and a **positive** integer `k`. A subset of `nums` is **beautiful** if it does not contain two integers with an absolute difference equal to `k`. Return _the number of **non-empty beautiful **subsets of the array_ `nums`. A **subset** of `nums` is an array that can be obtained by deleting some (possibly none) elements from `nums`. Two subsets are different if and only if the chosen indices to delete are different. **Example 1:** ``` **Input:** nums = [2,4,6], k = 2 **Output:** 4 **Explanation:** The beautiful subsets of the array nums are: [2], [4], [6], [2, 6]. It can be proved that there are only 4 beautiful subsets in the array [2,4,6]. ``` **Example 2:** ``` **Input:** nums = [1], k = 1 **Output:** 1 **Explanation:** The beautiful subset of the array nums is [1]. It can be proved that there is only 1 beautiful subset in the array [1]. ``` **Constraints:** `1 <= nums.length <= 18` `1 <= nums[i], k <= 1000`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [2,4,6], k = 2",12            "output": "4 "13        },14        {15            "label": "Example 2",16            "input": "nums = [1], k = 1",17            "output": "1 "18        }19    ],20    "private_test_cases": [],21    "haskell_template": "beautifulSubsets :: [Int] -> Int -> Int\nbeautifulSubsets nums k ",22    "ocaml_template": "let beautifulSubsets (nums: int list) (k: int) : int =  ",23    "scala_template": "def beautifulSubsets(nums: List[Int],k: Int): Int = { \n    \n}",24    "java_template": "public static int beautifulSubsets(List<Integer> nums, int k) {\n\n}",25    "python_template": "class Solution(object):\n    def beautifulSubsets(self, nums, k):\n        \"\"\"\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        \"\"\"\n        "26}