Asked inMathWorks,Engineering Development Group

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
Select
Add answer anonymously...
MathWorks Engineering Development Group Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits