Pergunta de entrevista da empresa Uber

Haker Rank medium to difficult Dynamic Programming question.