Description
Given an array of positive integers, add parentheses to maximize the division result. Return the expression as a string.
Examples
Input:
nums = [1000,100,10,2]Output:
"1000/(100/10/2)"Explanation:
1000*10*2/100=200.
Input:
nums = [8]Output:
"8"Explanation:
With only one number, no division operations are possible, so the result is just the number itself: 8.
Input:
nums = [12,6,3,2]Output:
"12/(6/3/2)"Explanation:
To maximize the result, divide the first number by the rest grouped together: 12/(6/3/2).
Constraints
- •
1 ≤ nums.length ≤ 10