numbers are written in a row separated by division signs: [6, 3, 4] becomes 6/3/4, evaluated left to right.
You may add brackets anywhere to change the order of operations. Find the bracketing that makes the value as large as possible and return that expression as a string: the numbers in their original order, / between them, no spaces.
The expression must have no redundant brackets: every pair of brackets has to change the result.numbers=[6, 3, 4] → '6/(3/4)'
6/(3/4) = 8, which beats 6/3/4 = 0.5.
numbers=[500, 2, 5, 10] → '500/(2/5/10)'
500/(2/5/10) = 500 · 5 · 10 / 2 = 12,500. Writing 500/((2/5)/10) would add redundant brackets, since division already goes left to right.
numbers=[7, 9] → '7/9'
Two numbers allow only one expression, and it needs no brackets.
numbers=[6, 3, 4]
'6/(3/4)'
Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.