Pregunta de entrevista de Barraiser

Leet code question of dynamic programming