FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2848,3 "name": "special-permutations",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/special-permutations/",6 "date": "2023-06-11",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 "test_case": [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 "constraints": [21 "For all indexes 0 <= i < n - 1, either nums[i] % nums[i+1] == 0 or nums[i+1] % nums[i] == 0.",22 "2 <= nums.length <= 14",23 "1 <= nums[i] <= 109"24 ],25 "python_template": "class Solution(object):\n def specialPerm(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n ",26 "java_template": "class Solution {\n public int specialPerm(int[] nums) {\n \n }\n}",27 "metadata": {28 "func_name": "specialPerm"29 }30}