Add dynamic programming algo.