Arrangement Problem Statement
Determine the number of permutations of list A
= [1, 2, ..., N] such that for every index i
, either A[i]
is divisible by i
or i
is divisible by A[i]
.
Input:
The input starts with an integer T
representing the number of test cases.
For each test case, there is a single integer N
.
Output:
For each test case, output the number of permutations on a new line.
Example:
Input:
2
1
2
Output:
1
2
Explanation:
For N = 1
, the permutation [1] satisfies the condition.
For N = 2
, the permutations [1, 2] and [2, 1] satisfy the condition.
Constraints:
1 <= T <= 10
0 <= N <= 15
- Time Limit: 1 second
Note:
You do not need to print anything or handle input. Implement the provided function to determine the output.
Be the first one to answer
Add answer anonymously...
>
MathWorks Engineering Development Group Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

