I am trying to figure out the most optimized code that will find the list of combinations that are between X, and Y for a given list like below:
- A = 4
- B = 6
- C = 3
- D = 5
- E = 4
- F = 1
And let's say X = 7, and Y = 16
So finds all the combinations whose sum are greater than or equal to X, and less than or equal to Y. The values can be repeated.
That is:
- AA
- AAA
- AAAA
- ABA
- ABB
- ABC
- ...
- EE
- EEE
- EEEE
- EA
- EAA
...And so on
Final condition: Duplicate arrangements should not be included. For example, ABB is the same as BBA, and BAB. So the latter two should not be included.
I am trying to find the most optimised code for this as the input list can contain up to 200 numbers...