Basically, given a sorted list of positive non-zero numbers, say {1, 4, 5}, change a single number in the list to maximize the distinct combinations possible. The above gives 1, 4, 5, 6, 9, 10, that is, six combinations. If we were to change 4 to 2 so we have {1, 2, 5}, we'd get 1, 2, 3, 5, 6, 7, 8, that is, seven combinations.
I need to find a number x to add to a single number of the list to maximize the amount of combinations. x should be the smallest abslout value, we can both add or subtract.
I've done it using brute force by enumeration, which runs in many times exponential time. So it's not feasible for larger problems. Now I need to do it fast.
Just checking the number of combinations is exponential time? And I have to find the exact optimal solution.
What would be some keywords for solving this problem? I've attempted to find a recurrence, so I could use dynamic programming and some sort of branch and bound to limit the explosion, but it's no use.
I've looked into problems like cutting mill, subset sum, and a lot of other combinatorial optimization problems to see if I could find some ideas. But I don't get it. Simply verifying the solution is exponential time.