Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. Find the minimum element. You may assume no duplicate exists in the array.
The given problem wants you to use the concept that the array is already sorted but at some point, the array is rotated and you are required to use the concept of binary search such that instead of traversing you complete the searching operation in logarithmic time.
Note: This problem is sometimes also asked in a different way, where we have to count the number of times the sorted array is rotated either in clockwise or counterclockwise. In this question, we just need to return the index of the minimum element.
The first line of the input consists of T number of test cases, each test case consists of N size of array, and the following line consists of N number of elements.
You need to print the minimum value of the element.
0 is the minimum value in the given array.
1 is the minimum value in the given array.