Dsa
Prefix Sum
Hard
Max Range Sum After Single Update
You are given an array of integers and allowed to perform a single update of any element to any integer you choose. Find the maximum possible sum of any contiguous subarray after this update. Input starts with an integer N (size of the array) followed by N integers.
Example:
Input:
5
1 -2 3 4 -1
Output:
8
Key concepts
prefix_summax_segment
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now