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 Original file line number Diff line number Diff line change 5
5
6
6
import java .util .Arrays ;
7
7
8
- @ SuppressWarnings ("java:S135" )
9
8
public class Solution {
10
9
public long maxSubarrays (int n , int [][] conflictingPairs ) {
11
10
long totalSubarrays = (long ) n * (n + 1 ) / 2 ;
@@ -49,12 +48,9 @@ public long maxSubarrays(int n, int[][] conflictingPairs) {
49
48
// (If there is no candidate pair at j, h[j] remains n+1.)
50
49
for (int j = 1 ; j <= n ; j ++) {
51
50
// no conflicting pair at index j
52
- if (h [j ] == n + 1 ) {
53
- continue ;
54
- }
55
51
// Only if removal would change h[j] (i.e. h[j] < d2[j])
56
52
// no alternative candidate exists
57
- if (d2 [j ] == h [j ]) {
53
+ if (h [ j ] == n + 1 || d2 [j ] == h [j ]) {
58
54
continue ;
59
55
}
60
56
// Simulate removal: new candidate at j becomes d2[j]
You can’t perform that action at this time.
0 commit comments