Basic Dynamic Programming Algorithm Examples Python