Skip to content

Commit

Permalink
2600
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangshanmeta committed Jan 17, 2025
1 parent 7030816 commit 09a0a5f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/2600.k-items-with-the-maximum-sum.2715/solution.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution {
public int kItemsWithMaximumSum(int numOnes, int numZeros, int numNegOnes, int k) {
if(k<=numOnes){
return k;
}
if(k<=numOnes+numZeros){
return numOnes;
}
return numOnes-(k-(numOnes+numZeros));
}
}

0 comments on commit 09a0a5f

Please sign in to comment.