
You are given an array 'arr' of 'n' integers.
Your task is to find the starting and ending indices of a contiguous subarray that has the largest possible sum.
The first line of input contains an integer 'n', representing the size of the array.
The second line contains 'n' space-separated integers, representing the elements of the array 'arr'.
Print two space-separated integers, start_index and end_index, which are the 0-based indices of the start and end of the maximum sum subarray.
If there are multiple subarrays with the same maximum sum, return the indices of the one that appears first (i.e., with the smallest starting index).
If the array contains all negative numbers, the subarray with the maximum sum will be the single element that is the largest (closest to zero).
9
-2 1 -3 4 -1 2 1 -5 4
3 6
The contiguous subarray [4, -1, 2, 1] has the largest sum of 6. Its starting index is 3 and its ending index is 6.
5
1 2 3 4 5
0 4
When all elements are positive, the maximum sum subarray is the entire array itself.
The expected time complexity is O(n).
1 <= n <= 10^5
-10^9 <= arr[i] <= 10^9
Time limit: 1 sec
The expected time complexity is O(n)