Derangement Interview Questions
Derangement interview question prep for no-fixed-point counting, hat-check examples, inclusion-exclusion, approximation, and common mistakes.
Candidates practicing permutation counting and inclusion-exclusion for quant interviews.
What derangement means
A derangement is an arrangement where no item remains in its original position. The classic story is hats returned so that nobody receives their own hat.
Use inclusion-exclusion
Count all permutations, subtract those with at least one fixed point, then correct for overlaps where multiple fixed points occur. This is a natural use case for inclusion-exclusion.
Concrete example
For three people, the derangements are 231 and 312 if original order is 123. There are 2 derangements out of 6 permutations, so the probability is 1/3.
Approximation intuition
For larger n, the probability of a random permutation being a derangement approaches about 1/e. In interviews, explain the counting setup before quoting the approximation.
Where it appears
Derangement structure can appear in matching, assignments, seating, and random shuffles where fixed points are forbidden.
Common mistakes
Candidates often subtract fixed-point cases but forget to add back overlaps. Inclusion-exclusion exists because fixed-point events overlap.
Practice the pattern
Use the LeetQuidity curriculum and calibration to turn this topic into a focused practice plan.