Derangement is one well-known problem in the filed of probability theory. An in- stance of a derangement problem contains a finite collection C of n paired objects, C = {(x1 , y1 ), ..., (xn , yn )}. The derangement problem asks how many ways to gener- ate a new collection C′ ̸= C such that for each (xi,yj) ∈ C′,i ̸= j. We propose an efficient dynamic programming algorithm that divides an instance of the derangement problem into several subproblems. During a recursive process of unrolling a subproblem, there exists a repeated procedure that allows us to make a use of a subsolution that has already been computed. We present the methodology to formulate a concept of this subproblem as well as parts of designing and analyzing an efficiency of the proposed algorithm.