It's a classic dynamic programming problem. min[i][j] - minimum value for the subexpression starting at i-th position and ending at j-th, max[i][j] - the same but stores maximum value. Use these value to calculate value max[0][N-1], N - size of the expression.
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.