File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed
s3507_minimum_pair_removal_to_sort_array_i
s3509_maximum_product_of_subsequences_with_an_alternating_sum_equal_to_k
s3510_minimum_pair_removal_to_sort_array_ii Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,16 @@ public int minimumPairRemoval(int[] nums) {
1919 // Merge the pair at index
2020 int [] newNums = new int [nums .length - 1 ];
2121 int j = 0 ;
22- for (int i = 0 ; i < nums .length ; i ++) {
22+ int i = 0 ;
23+ while (i < nums .length ) {
2324 if (i == index ) {
2425 newNums [j ++] = nums [i ] + nums [i + 1 ];
2526 // Skip the next one since it's merged
2627 i ++;
2728 } else {
2829 newNums [j ++] = nums [i ];
2930 }
31+ i ++;
3032 }
3133 nums = newNums ;
3234 operations ++;
Original file line number Diff line number Diff line change 77import java .util .LinkedList ;
88import java .util .Queue ;
99
10+ @ SuppressWarnings ("java:S135" )
1011public class Router {
1112 private final int size ;
1213 private int cur ;
Original file line number Diff line number Diff line change 66import java .util .HashMap ;
77import java .util .Map ;
88
9+ @ SuppressWarnings ("java:S6541" )
910public class Solution {
1011 static class StateKey {
1112 int prod ;
Original file line number Diff line number Diff line change 66import java .util .Arrays ;
77import java .util .List ;
88
9+ @ SuppressWarnings ("java:S127" )
910public class Solution {
1011 public int minimumPairRemoval (int [] nums ) {
1112 int n = nums .length ;
@@ -64,16 +65,16 @@ public int minimumPairRemoval(int[] nums) {
6465 }
6566
6667 public static class MinHeapL {
67- public long [] hi ;
68- public long [] lo ;
69- public int [] map ;
70- public int [] imap ;
71- public int n ;
72- public int pos ;
73- public static final long INF = Long .MAX_VALUE ;
68+ static final long INF = Long .MAX_VALUE ;
69+
70+ long [] hi ;
71+ long [] lo ;
72+ int [] map ;
73+ int [] imap ;
74+ int n ;
75+ int pos ;
7476
7577 public MinHeapL (int m ) {
76- // ヒープ配列のサイズは内部実装に合わせて決定
7778 n = Integer .highestOneBit ((m + 1 ) << 1 );
7879 hi = new long [n ];
7980 lo = new long [n ];
You can’t perform that action at this time.
0 commit comments