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?