2sum and subsets impl