Given an arithmetic expression containing '+', '-', '*' operators, generate a string by placing parenthesis in the given expression which will return the the maximum possible value of that expression.
eg: I/p -------> 8+4*2 O/p ------> ((8+4)*2) corresponding to a max value of 24
I/p -------> 5-8+7*4-8*9 O/p ------> (5 - ((8 + 7)*(4 - (8*9)))) corresponding to a max value of 1025.
I solved this question using recursion by putting bracket at all possible places and evaluate the answer through recursion and found the maximum out of them.
We can solve this question by applying paranthesis at all places and then evaluating them using recursion and calculate the maximum answer.It is similiar to matrix chain multiplication concept but we ...read more
Top Cisco Networking Academy Software Developer interview questions & answers
Popular interview questions of Software Developer
Reviews
Interviews
Salaries
Users/Month