Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
It is always optimal to take items with the number 1 written on them as much as possible.
If k > numOnes, after taking all items with the number 1, it is always optimal to take items with the number 0 written on them as much as possible.
If k > numOnes + numZeroes we are forced to take k - numOnes - numZeroes -1s.