You are given an arithmetic expression.
The expression is a sum of one or more terms.
Each term is a product of exactly two variables.
In each term, the two variables are distinct.
No two terms contain the same pair of variables.
Additionally, the following constraints are given:
- For each i, the i-th variable (0-based index) must have a value between lowerBound[i] and upperBound[i], inclusive. The bounds are integers, but the value of the variable can be any real number in the given range.
- The sum of all variables must not exceed maxSum.
You are given a String[] expr, the int[]s lowerBound and upperBound, and the int maxSum.
Concatenate the elements of expr to obtain the considered expression.
For each i, the i-th variable will be denoted by the i-th lowercase letter of the English alphabet.
(Both indices are 0-based, so variable 0 is 'a', variable 1 is 'b', and so on.)
Return the maximum value of the expression, given that all the above constraints have to be satisfied.
Note that the constraints guarantee that it is possible to satisfy all the given constraints.