Need help with this problem

Revision en2, by NoobCoder1998, 2025-01-12 11:51:49

You are given 2 arrays. Choose a subarray from the first array (arr1) and replace it with the corresponding subarray from the second array (arr2). After replacing the subarray, calculate the maximum consecutive subarray sum of the modified first array. Find the maximum subarray sum you can get by doing this operation. You can do this operation only once

N is 10^5 and ai [-1e9, 1e9]

Im not able to think of better than n^2. Pls help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English NoobCoder1998 2025-01-12 11:52:07 1 Tiny change: ' only once\n\n\nN is' -> ' only once.\n\n\nN is'
en2 English NoobCoder1998 2025-01-12 11:51:49 39
en1 English NoobCoder1998 2025-01-12 11:51:07 438 Initial revision (published)