Derangements
Medium
Counting & Combinatorics
A derangement is a permutation of 1..n in which no element stays in its original position. Print the number of derangements modulo 1,000,000,007.
Constraints
1 <= n <= 10^6
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.