Algorithm to pick values from array that sum closest to a target value?

This problem is known as the subset sum problem, which is a special case of the Knapsack problem. Wikipedia is a good starting point for some algorithms.

Leave a Comment