Greedy & dynamic approach
I was recently asked this question in aptitute test:
Write a code to maximize the given expresion having +,- using greedy approach in O(n) and dynamic approach in O(n3).
For dynamic approach i thought we can make use of matrix chain multiplication.
I would like to know if any one has a better approach or code to solve this.