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.
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.