Comments

Yes, seeing many of submissions use greedy. Why this greedy approach can work? Any proof or idea can help me better understanding on this? Thanks!

On flash_7 → Digit DP, 7 years ago
0

Really good article about digit DP.

Another O(n) solution for Div1A/Div2D. 50724905

Consider some station i. The front array to store maximum steps when ending with station (1~i-1). The back array to store maximum steps when ending with station (i~n).

0

You can check this testcase:

8
1 2 1 2 2 1 2 1

Yes, I think time complexity is O(n). We build the output of size n.

On HadyKo → denial of judgement!, 8 years ago
0

Me too.