Help Needed in a short interesting problem

Revision en1, by vatsalseth33, 2020-10-05 10:45:14

Problem : Given an array A of integers,you can remove some elements as per your wish without changing the order of the remaining elements. After removing, value of A becomes sum(i*A[i]) from i = 1 to K(new size of A). Find maximum value of A possible after modification. Example: A = [-1,-9,0,5,-7] Answer = 14 (remove -9 and -7 so value = -1*1 + 0*2 + 5*3) I feel it is dp but cannot visualise it. Can anyone please help me out here?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English vatsalseth33 2020-10-05 10:51:09 20
en1 English vatsalseth33 2020-10-05 10:45:14 481 Initial revision (published)