Skip to content

Commit cbd08cd

Browse files
committed
Fixed sonar
1 parent b0c9712 commit cbd08cd

File tree

1 file changed

+1
-5
lines changed
  • src/main/java/g3401_3500/s3480_maximize_subarrays_after_removing_one_conflicting_pair

1 file changed

+1
-5
lines changed

src/main/java/g3401_3500/s3480_maximize_subarrays_after_removing_one_conflicting_pair/Solution.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import java.util.Arrays;
77

8-
@SuppressWarnings("java:S135")
98
public class Solution {
109
public long maxSubarrays(int n, int[][] conflictingPairs) {
1110
long totalSubarrays = (long) n * (n + 1) / 2;
@@ -49,12 +48,9 @@ public long maxSubarrays(int n, int[][] conflictingPairs) {
4948
// (If there is no candidate pair at j, h[j] remains n+1.)
5049
for (int j = 1; j <= n; j++) {
5150
// no conflicting pair at index j
52-
if (h[j] == n + 1) {
53-
continue;
54-
}
5551
// Only if removal would change h[j] (i.e. h[j] < d2[j])
5652
// no alternative candidate exists
57-
if (d2[j] == h[j]) {
53+
if (h[j] == n + 1 || d2[j] == h[j]) {
5854
continue;
5955
}
6056
// Simulate removal: new candidate at j becomes d2[j]

0 commit comments

Comments
 (0)