Pocket Gems interview question

Dynamic programming