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
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter