Greedy Algorithm Vs Dynamic Programming In Python