Oct-30-2023, 05:41 AM
(This post was last modified: Oct-30-2023, 05:41 AM by Gribouillis.)
This is a well-known problem in theoretical computer science, the subset sum problem, which is known to be NP-hard, which means that no fast algorithm will solve the problem when the size of the input data is large (eg the length of the list).
I have found one package (untested) in the Python Package Index subsetsum but it relies on C++ code. You could perhaps check this package.
Apart from this, a search engine finds pure Python implementations such as this one.
I have found one package (untested) in the Python Package Index subsetsum but it relies on C++ code. You could perhaps check this package.
Apart from this, a search engine finds pure Python implementations such as this one.