justtest
BAN USER
Questions (1)
Comments (3)
Reputation 70
- 0of 0 votes
AnswersGiven an array[0, n-1], each number of the array is positive int. Your task is adding the operators,"+","*", "(",")" (add, multiply, parenthesis) to maximize the result . The position in the array is Fixed.
- justtest in United States
For example, "2,1,1,2", you can get (2+1)*(2+1)=9.
Follow up, if the number may be negative , how to solve it ?| Report Duplicate | Flag | PURGE
Algorithm Brain Teasers Coding Data Structures Dynamic Programming
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
(2*1) * (1*2) = 4 < (2+1)*(2+1) = 9
- justtest August 22, 2014