0

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.

Thanks
Bryan

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by TomW
0

Take a look at the Array.IndexOf method in the help file. It will show how to search an array and return the index of the result if found or -1 if not found.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.