IBM interview question

Dynamic programming