Prime Arrangements
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Consider all permutations of the integers 1 through n. Positions are 1-indexed. Count the
permutations in which every prime number sits at a prime position (and therefore every non-prime
number sits at a non-prime position). Recall that 1 is not prime.
Because the count grows quickly, return it modulo 10^9 + 7.
Examples
Constraints
- 1 <= n <= 100
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.