Help Needed in a short interesting problem

Правка en2, от vatsalseth33, 2020-10-05 10:51:09

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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский vatsalseth33 2020-10-05 10:51:09 20
en1 Английский vatsalseth33 2020-10-05 10:45:14 481 Initial revision (published)