Suppose you have N integers from 1 to N. Generate all possible unique
arrangement of the list such that none of the element is in the respective
position. Print the count of all possibilities
INPUT
Range of the list 'N
1<=N<=100
OUTPUT
Count of all possible unique arrangements
SAMPLE INPUT
3
SAMPLE OUTPUT
2
EXPLANATION
E
The generated list will be [1,2,3]. The possibilities are [3.2.1) and (3,1,2). (Le)
2 unique possibilities.
Answers
Answered by
0
Answer:
A Derangement is a permutation of n elements, such that no element appears in its original position. For example, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0}.
Given a number n, find total number of Derangements of a set of n elements.
Explanation:
Similar questions