Dsa
Arrays
Easy
Kadane's Variation with Start and End Indices
Implement a function that finds the maximum sum of a contiguous subarray in an integer array, and returns the start and end indices of that subarray.
Example:
Input:
5
-2 -3 4 -1 -2
Output:
1 3
(max sum is from index 1 to 3: 4 - 1 - 2)
Key concepts
arraysmaximum subarrayindices
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