Pergunta de entrevista da empresa DoorDash

Question that was related to dynamic programming