corrected the solution from top down to bottom up
check the that the previous solution is most optimal, takes in how many steps