Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How to solve this problem if no deletions are allowed ?
Try deleting each element and find the maximum subarray sum to both sides of that element.
To do that efficiently, use the idea of Kadane's algorithm.