Pregunta de entrevista de Samsung R&D Institute Bangladesh

A dynamic programming problem of basic difficulty.