Adapt the function to return the indices of the subarray by returning a tuple of (sum, srt_idx, end_idx).