Company: Cognizant_20june
Difficulty: medium
Circular Array Shift Problem Description You are given an integer array A of length N . You are allowed to perform any number of circular left or right shifts, each by 1 unit. Your task is to find and return an integer value representing the minimum number of circular shifts required such that at least one element becomes equal to its 1-based index. Return -1 if no such shift is possible. Input Specification: input1: An integer value N , representing the number of elements. input2: An integer array A . Output Specification: Return an integer value representing the minimum number of circular shifts required such that at least one element becomes equal to its 1-based index. Return -1 if no such shift is possible. Examples Example 1: Input: input1 = 5, input2 = [5,3,2,1,4] Output: 1 Explanation: Here, there are 5 elements in the array which are (5,3,2,1,4) . We can find the circular shifts as below: On left shifting once, the array will become (3,2,1,4,5) . Here, the elements 2, 4 and 5 b