Citadel interview question

Some dynamic programming question