Pregunta de entrevista de GlobalLogic

Question from dynamic programming and data structure