Maximum Sum of 3 NonOverlapping Intervals


As given in the example
Input: [1,2,1,2,6,7,5,1], 2
Output: [0, 3, 5]
Explanation: Subarrays [1, 2], [2, 6], [7, 5] correspond to the starting indices [0, 3, 5].
We could have also taken [2, 1], but an answer of [1, 3, 5] would be lexicographically larger.We also have a subarray [6,7] ; why is it not being considered ? Is it because of the "nonoverlapping" criteria? They just touch each other [2,6], [6,7], [7,5] and sums to (8, 13, 12)
Can anyone please explain ???

@sha256pki This is done to get lexicographically smallest output, in the 'right' array we need the leftmost maximum sum available.
