Amazon Interview Question

Dynamic programming example