File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed
src/main/java/g3401_3500/s3480_maximize_subarrays_after_removing_one_conflicting_pair Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff line change 55
66import java .util .Arrays ;
77
8- @ SuppressWarnings ("java:S135" )
98public 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]
You can’t perform that action at this time.
0 commit comments