Amazon Interview Question

A coding questions about Dynamic programming