Conviva interview question

Whiteboard type algorithm dynamic programming question.