X interview question

Dynamic Programming