[add new solution][Q17.6]find indices such that if numbers between them are sorted then the whole array is sorted