Can anyone tell me how to optimise my O(N) dp solution

Revision en1, by practice_account, 2020-06-28 02:06:04

Question — 1221D - Make The Fence Great Again My submission — 85248917 I have written a O(N) dp solution still it does not pass the 17th testcase. I have seen the editorial which also has a O(N) solution. Can anyone please tell me where am I doing the extra work here.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English practice_account 2020-06-28 02:06:04 330 Initial revision (published)