Hiya interview question

A Dynamic Programming question