Pergunta de entrevista da empresa Arcesium

Dynamic programming question. (Stock prices in a week)