I am looking for an algorithm in $O(N^2)$ that finds the maximum value that be obtained from a sequence of real numbers greater than 0 (e.g. $\{ 1, 2, 3 , 4\}$) by inserting a plus ($+$) or multiplication ($\times$) between the elements.
Really not having much luck and wondering if anyone has any insight on this?
It must follow normal order of precedence.
For example with $\{1,2,3,4\}$, the maximum is $1+2\times3\times4 = 25$ not $1\times2\times3\times4 = 24$ and not $1\times2+3+4 = 9$.