C# - Combinatorics

Viewed 350

I have a list of ~300 objects which all have a price and a score. I need to find the best combination (i.e. highest total score) of 15 of those objects whose total price is less than X.

The most straightforward way to do this, as I see it, is to nest 15 for loops and check every possible combination, but that would take days.

Is there any 'clean' way to do this in C#?

Thanks!

2 Answers
Related