Hey there, long time reader, first time post;
Here is my situation: I need to search through an array of X numbers (X is going to change, so for example, one instance could be that X = 20, the next could be X = 67).
I need to find how many combinations of 1000 I can make. For example, each element in the array is going to be a number that is less than 1000. I want to see how many combinations I can make of the elements in the array (and what the combination is) such that the total of the combination is within 20 of 1000 (but not to exceed 1000). If getting within 20 is not possible, the range can increase to 30. If 30 is not possible, the range can increase to 40 and so on.
Every time an element in the array is used to get the combination closer to 1000, that element is to be deleted and NOT used for further combinations.
The deliverable from this function would be the number of combinations along with what each combination is made of.
I am really having trouble with this. Any help is appreciated.