You are given an integer array nums. The adjacent elements in nums represent a sequence of floating point divisions, evaluated from left to right. For example, [2, 3, 4] corresponds to the expression
You may add any number of parentheses at any position to change the precedence of the operations. Determine the placement of parentheses that maximizes the evaluated result of the expression.
Return the expression that produces the maximum value as a string.
Note: Any redundant parentheses that do not influence the order of operations must be omitted.
Constraints:
nums.length
nums[i]
There is only one optimal division for the given input.
You are given an integer array nums. The adjacent elements in nums represent a sequence of floating point divisions, evaluated from left to right. For example, [2, 3, 4] corresponds to the expression
You may add any number of parentheses at any position to change the precedence of the operations. Determine the placement of parentheses that maximizes the evaluated result of the expression.
Return the expression that produces the maximum value as a string.
Note: Any redundant parentheses that do not influence the order of operations must be omitted.
Constraints:
nums.length
nums[i]
There is only one optimal division for the given input.