Skip to content

Commit 66d2c94

Browse files
authored
Update Solution.java
1 parent 5ff484f commit 66d2c94

File tree

1 file changed

+0
-2
lines changed
  • src/main/java/g3001_3100/s3086_minimum_moves_to_pick_k_ones

1 file changed

+0
-2
lines changed

src/main/java/g3001_3100/s3086_minimum_moves_to_pick_k_ones/Solution.java

-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ public long minimumMoves(int[] nums, int k, int maxChanges) {
2626
return Math.max(0, maxAdjLen - 1) + (k - maxAdjLen) * 2L;
2727
}
2828
}
29-
3029
int[] ones = new int[numOne];
3130
int ind = 0;
3231
for (int i = 0; i < n; i++) {
3332
if (nums[i] == 1) {
3433
ones[ind++] = i;
3534
}
3635
}
37-
3836
long[] preSum = new long[ones.length + 1];
3937
for (int i = 1; i < preSum.length; i++) {
4038
preSum[i] = preSum[i - 1] + ones[i - 1];

0 commit comments

Comments
 (0)