Pregunta de entrevista de Impact Analytics

Medium level dynamic programming question