File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/main/java/g3601_3700/s3698_split_array_with_minimum_difference Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ public long splitArray(int[] nums) {
77 int i = 1 ;
88 int n = nums .length ;
99 long suml = nums [0 ];
10- long sumr = 0 ;
10+ long sumr ;
1111 while (i < n && nums [i ] > nums [i - 1 ]) {
1212 suml += nums [i ];
1313 i ++;
@@ -28,10 +28,10 @@ public long splitArray(int[] nums) {
2828 if (suml <= sumr ) {
2929 return sumr - suml ;
3030 } else {
31- if (suml - sumr - 2 * pivot > 0 ) {
32- return suml - sumr - 2 * pivot ;
31+ if (suml - sumr - 2L * pivot > 0 ) {
32+ return suml - sumr - 2L * pivot ;
3333 } else {
34- return Math .min (suml - sumr , Math .abs (suml - sumr - 2 * pivot ));
34+ return Math .min (suml - sumr , Math .abs (suml - sumr - 2L * pivot ));
3535 }
3636 }
3737 }
You can’t perform that action at this time.
0 commit comments