Pregunta de entrevista de Visa Inc.

Better solution than dynamic programming?