algorithm for sum of subsets problem