untested implementation of a subset sum variant dynamic programming solution