Reverse One Segment — Solution & Editorial
Locate the first and last positions that disagree with the sorted copy, reverse that segment, and check the result equals the sorted array.
Complexity: O(N log N)
Locate the first and last positions that disagree with the sorted copy, reverse that segment, and check the result equals the sorted array.
Complexity: O(N log N)