BlackRock interview question

Java question on Dynamic Programming.