in this problem there could be possibly more than one segment. For ex if the array is 146874519567 and left is 1 and right is 7 then there are more than one segment. What to do in this case?
They are the indices, not the value. Your segment would be
1 4 6 8 7 4 5