You are given a string expression representing an addition expression of the form "<num1>+<num2>" where <num1> and <num2> represent positive integers.
Add exactly one pair of parentheses to expression such that the left parenthesis is placed anywhere to the left of '+' and the right parenthesis is placed anywhere to the right of '+'.
Evaluating the modified expression computes the product of the number before the left parenthesis, the sum inside the parentheses, and the number after the right parenthesis. If there is no number before the left parenthesis or after the right parenthesis, that factor is treated as
Return the resulting string after adding parentheses that minimizes the evaluated value. If multiple valid expressions yield the minimum value, return any of them.
Constraints:
expression.length
expression consists of digits from
expression starts and ends with digits.
expression contains exactly one
The original value of expression and the value of expression after adding any valid pair of parentheses fits within a signed
You are given a string expression representing an addition expression of the form "<num1>+<num2>" where <num1> and <num2> represent positive integers.
Add exactly one pair of parentheses to expression such that the left parenthesis is placed anywhere to the left of '+' and the right parenthesis is placed anywhere to the right of '+'.
Evaluating the modified expression computes the product of the number before the left parenthesis, the sum inside the parentheses, and the number after the right parenthesis. If there is no number before the left parenthesis or after the right parenthesis, that factor is treated as
Return the resulting string after adding parentheses that minimizes the evaluated value. If multiple valid expressions yield the minimum value, return any of them.
Constraints:
expression.length
expression consists of digits from
expression starts and ends with digits.
expression contains exactly one
The original value of expression and the value of expression after adding any valid pair of parentheses fits within a signed