Maximum sum :)

Revision en2, by invoker._, 2022-06-04 15:19:51

So here is the problem

Let array A = { a1,a2,a3,...an} postitive integers

F(i,j) = min(ai,ai+1,....,aj) * (i-j+1);

Find the maximum value of F(i,j) for any I and J.

Example: A = {5,3,1,1}

(I = 1 J = 2) : SUM = 6

Example: A = {3,1,3,1,2}

(I = 1 J = 5) : SUM = 5

Tags dp, help, arrays

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English invoker._ 2022-06-04 15:19:51 559
en1 English invoker._ 2022-06-04 14:34:39 868 Initial revision (published)