Pregunta de entrevista de Samsung Electronics

Question based on subinterval (Dynamic programming)