dynamic programming table

added table based approach. Guaranteed optimal solution, but won’t
solve large inputs quickly.