New answers tagged math
This is the subset sum problem. The subset sum problem is NP-complete. In general the solution requires an exhaustive search, so the run time complexity is O(2^N) where N is the number of values in the set. Alternatively, if the desired sum S is small, dynamic programming can be used with a run time complexity of O(NS).
Top 50 recent answers are included