Practice Special Permutations
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
nums contains distinct positive integers. Count its permutations in which, for every adjacent pair, one value divides the other. Return the count modulo 10^9 + 7.
Source: Special Permutations on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [2,3,6]
Output
2
# Example 2
Input
nums = [1,4,3]
Output
2
Constraints
2 <= nums.length <= 14
1 <= nums[i] <= 10^9
Related LeetCode Problems
Practice more problems similar to Special Permutations.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.