Leetcode 2600. K Items With the Maximum Sum
Given counts of items worth 1, 0, and -1, pick exactly k items to maximize the total sum — effectively take as many 1s as possible, then zeros, and only use -1s if k exceeds ones+zeros, and return the resulting sum.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.