CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 2848,3    "name": "special_permutations",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/special-permutations/",6    "date": "2023-06-11 00:00:00",7    "task_description": "You are given a **0-indexed** integer array `nums` containing `n` **distinct** positive integers. A permutation of `nums` is called special if: For all indexes `0 <= i < n - 1`, either `nums[i] % nums[i+1] == 0` or `nums[i+1] % nums[i] == 0`. Return _the total number of special permutations. _As the answer could be large, return it **modulo **`109 + 7`. **Example 1:** ``` **Input:** nums = [2,3,6] **Output:** 2 **Explanation:** [3,6,2] and [2,6,3] are the two special permutations of nums. ``` **Example 2:** ``` **Input:** nums = [1,4,3] **Output:** 2 **Explanation:** [3,1,4] and [4,1,3] are the two special permutations of nums. ``` **Constraints:** `2 <= nums.length <= 14` `1 <= nums[i] <= 109`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [2,3,6]",12            "output": "2 "13        },14        {15            "label": "Example 2",16            "input": "nums = [1,4,3]",17            "output": "2 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                584117688,24                128132521,25                483733809,26                538103732,27                157980701,28                84500114,29                369758978,30                417335206,31                83499263332            ],33            "output": 034        },35        {36            "input": [37                716189780,38                829231105,39                799685662,40                706127727,41                642091233,42                653562772,43                19107990,44                817847028,45                452438656,46                309420299,47                224255714,48                378823621,49                893604088,50                55523172551            ],52            "output": 053        },54        {55            "input": [56                915827588,57                281855433,58                282404443,59                237318432,60                258066764,61                83688214,62                236117470,63                134376301,64                125033736,65                406824599,66                806597217,67                175838204,68                44810834769            ],70            "output": 071        },72        {73            "input": [74                726633986,75                400995617,76                693097314,77                440474407,78                63494536,79                993852230,80                881042725,81                92456481082            ],83            "output": 084        },85        {86            "input": [87                744707562,88                793994140,89                180416571,90                473700883,91                587397301,92                367020656,93                905392500,94                925682568,95                353345376,96                696934710,97                546914520,98                207602398,99                366110622,100                970835618101            ],102            "output": 0103        }104    ],105    "haskell_template": "specialPerm :: [Int] -> Int\nspecialPerm nums ",106    "ocaml_template": "let specialPerm (nums: int list) : int =  ",107    "scala_template": "def specialPerm(nums: List[Int]): Int = { \n    \n}",108    "java_template": "class Solution {\n    public int specialPerm(int[] nums) {\n        \n    }\n}",109    "python_template": "class Solution(object):\n    def specialPerm(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: int\n        \"\"\"\n        "110}