Pergunta de entrevista da empresa Google

Q. I was given a 1D array and the question was to be solved from DP(optimally]