You are given two arrays of size n. You need to choose the sub-array from the first array and replace it with a corresponding sub-array from the second array.↵
Now, find the **maximum consecutive sub-array sum** in the modified first array.↵
↵
_Sample Input 1-_↵
2↵
↵
2↵
↵
↵
4 -2↵
↵
↵
1 2↵
↵
↵
_Sample Output 1-_↵
↵
↵
6↵
↵
_Sample Input 2-_↵
8↵
↵
8↵
↵
↵
-2 2 -3 1 -1 -1 1 0↵
↵
↵
4 -3 3 3 2 -5 3 4↵
↵
↵
_Sample Output 2-_↵
↵
↵
12
Now, find the **maximum consecutive sub-array sum** in the modified first array.↵
↵
_Sample Input 1-_↵
↵
2↵
↵
↵
4 -2↵
↵
↵
1 2↵
↵
↵
_Sample Output 1-_↵
↵
↵
6↵
↵
_Sample Input 2-_↵
↵
8↵
↵
↵
-2 2 -3 1 -1 -1 1 0↵
↵
↵
4 -3 3 3 2 -5 3 4↵
↵
↵
_Sample Output 2-_↵
↵
↵
12