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