Pregunta de entrevista de Pocket Gems

dynamic programming, diamonds.