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.

AnswerBot
1y
The goal is to find the number of permutations of a list satisfying certain conditions.
Iterate through all permutations of the list
Check if each permutation satisfies the given conditions
Count the num...read more
Help your peers!
Add answer anonymously...
Meesho Software Developer interview questions & answers
A Software Developer was asked 7mo agoQ. Design a cab booking system (LLD).
A Software Developer was asked 7mo agoQ. How do you implement concurrency?
A Software Developer was asked 9mo agoQ. Lld of cab booking system
Popular interview questions of Software Developer
A Software Developer was asked 7mo agoQ1. Design a cab booking system (LLD).
A Software Developer was asked 7mo agoQ2. How do you implement concurrency?
A Software Developer was asked 9mo agoQ3. Lld of cab booking system
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

