Find Minimum in Rotated Sorted Array
Try to solve the Find Minimum in Rotated Sorted Array problem.
We'll cover the following
Statement
You’re given a rotated sorted array, arr
, of length
For example,
Before rotation,
arr
After
rotations, the array becomes .
Mathematically, we can say that if the original array was
First rotation:
Second rotation:
Third rotation:
In the example above, the minimum element is
For the given array, your task is to find the minimum element of this array.
Constraints:
arr.length
arr[i]
All the elements of the array are distinct, that is, there are no duplicate elements.
Examples
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.