Made this recurrence problem dynamicic (next move if it was already done it will find it in the array instead of re-computing it)