You are given four integers numOnes, numZeros, numNegOnes, and k.
There is a bag containing items with numbers written on them:
numOnes items with the number
numZeros items with the number
numNegOnes items with the number
Your task is to select exactly k items from the bag such that the sum of their values is maximized. Return the maximum possible sum.
Constraints:
numOnes, numZeros, numNegOnes
k numOnes numZeros numNegOnes
You are given four integers numOnes, numZeros, numNegOnes, and k.
There is a bag containing items with numbers written on them:
numOnes items with the number
numZeros items with the number
numNegOnes items with the number
Your task is to select exactly k items from the bag such that the sum of their values is maximized. Return the maximum possible sum.
Constraints:
numOnes, numZeros, numNegOnes
k numOnes numZeros numNegOnes