Started implementing dynamic programming approach in problem 5