Finished Dynamic Programming for first case :D