Sort array by reversing a specific segment of the array
Given an array Arr[ ] that consists of N distinct integers. Check that if it is possible to sort the array in ascending order by reversing a specific segment of the array. If it is possible then print the starting and the ending position of the segment. If it is not possible then print -1. Given that the… Read More »