combinations adding upto a number
optimal partitioning