Find Minimum Rotations to Sort an Array in Non-Decreasing Order
Given an array of n integers, you need to find minimum number of below operation such that arrays becomes sorted in non-decreasing order. In a single operation you can rotate the given array clockwise one time. Print -1 if it is not possible to sort the array. Examples: Input: {8, 4, 6} Output: 2 Explanation: After applying operation… Read More »