Skip to content

Commit 3c0e0a7

Browse files
committed
Fixed sonar
1 parent b85ca07 commit 3c0e0a7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/java/g3301_3400/s3364_minimum_positive_sum_subarray/Solution.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ public int minimumSumSubarray(List<Integer> nums, int l, int r) {
1414
for (int j = i; j < i + s; j++) {
1515
sum += nums.get(j);
1616
}
17-
if (sum > 0) {
18-
if (res == -1 || res > sum) {
19-
res = sum;
20-
}
17+
if (sum > 0 && (res == -1 || res > sum)) {
18+
res = sum;
2119
}
2220
}
2321
}

src/main/java/g3301_3400/s3366_minimum_array_sum/Solution.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ private int sub(Integer[][][] dp, int[] nums, int i, int k, int op1, int op2) {
3232
int v = (int) Math.ceil(nums[i] / 2.0);
3333
res = Math.min(res, sub(dp, nums, i + 1, k, op1 - 1, op2) + v);
3434
}
35-
return dp[i][op1][op2] = res;
35+
dp[i][op1][op2] = res;
36+
return res;
3637
}
3738
}

src/main/java/g3301_3400/s3367_maximize_sum_of_weights_after_edge_removals/Solution.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ private long[] maximizeSumOfWeights(
2323
for (int[] i : map.get(v)) {
2424
if (i[0] != from) {
2525
long[] next = maximizeSumOfWeights(i[0], v, k, map);
26-
sum += Math.max(next[0], next[1] += i[1]);
26+
next[1] += i[1];
27+
sum += Math.max(next[0], next[1]);
2728
if (next[0] < next[1]) {
2829
queue.offer(next[1] - next[0]);
2930
sum -= queue.size() > k ? queue.poll() : 0;

0 commit comments

Comments
 (0)