A sorted array arr of size N which is rotated at some unknown point. The task is to find the minimum element in it. All the elements in the array are distinct.
Note: Expected time complexity is O(logN).
The first line of input contains an integer T denoting the number of test cases. Each test case contains the number of elements in the array arr as N and next line contains space separated n elements in the array arr.
Print an integer which denotes the minimum element in the array.
1 <= T <= 100
1 <= N <= 107
1 <= arr[i] <= 107
2 3 4 5 6 7 8 9 10 1
3 4 5 1 2
Testcase 1: The array is rotated once anti-clockwise. So minium element is at last index (n-1) which is 1.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.