Pregunta de entrevista de DoorDash

Question that was related to dynamic programming