The answer could be very large, output answer %(10 ^ 9 + 7).
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line and the only line of each test case contains an integer ‘N’ denoting the number of elements whose derangements are to be counted.
For each test case, return the total number of derangements of a set of ‘N’ elements.
You don't need to print anything, it has been already taken care of. Just implement the given function.
1 <= T <= 100
1 <= N <= 3000
Time limit: 1 sec
DECODE STRING
Randomly Sorted
Merge Two Sorted Arrays Without Extra Space
Co-Prime
8-Queen Problem