Add solution of dynamic programming.