FactSet interview question

question on dynamic programming.