##
Count Derangements (Permutation such that no element appears in its original position)
November 18, 2015

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. Examples: Input: n = 2 Output: 1 For two… Read More »