Why this isn't 1-D dp ?

Revision en1, by kaiyu, 2020-05-10 17:39:30

Problem Link:

https://www.codechef.com/problems/GRHARSH

I see all the solutions have 2D dp solution.

I was thinking dp[i] = max gold at the time i.

Is this correct? If it is, can somebody post the correct 1D dp code in the comment section?

And can someone explain the 2D solution as well? Thank you!

Tags #2d-dp, #dp, 1d-dp, #dynamic programing

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English kaiyu 2020-05-10 18:13:26 130
en1 English kaiyu 2020-05-10 17:39:30 339 Initial revision (published)