Problem statement

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

[4,5,6,7,0,1,2] if it was rotated 4 times.  
[0,1,2,4,5,6,7] if it was rotated 7 times.  

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]]

Given the sorted rotated array nums of unique elements, return the minimum element of this array.

You must write an algorithm that runs in $O(log n)$ time.
Link to problem

Example 1

Input: nums = [3,4,5,1,2]
Output: 1
Explanation: The original array was [1,2,3,4,5] rotated 3 times.

Example 2

Input: nums = [4,5,6,7,0,1,2]
Output: 0
Explanation: The original array was [0,1,2,4,5,6,7] and it was rotated 4 times.

Example 3

Input: nums = [11,13,15,17]
Output: 11
Explanation: The original array was [11,13,15,17] and it was rotated 4 times. 

Solutions

Essentially how binary search works, but with a slight twist.
You start out the algorithm like usual but check if middle element is greater than the left most element, this will tell you weather the middle element is a part of left subarray or not. If it is a part of left subarray then that means the subarray containing lesser valued elements is the right subarray.
i.e., the values wrapped around hence the beginning is smaller than the middle.

Implementation in Rust

fn search_min(numbers: Vec<i32>) -> i32
{
    let mut left_ptr = 0;
    let mut right_ptr = numbers.len() - 1;

    while left_ptr < right_ptr {
        let mid = (right_ptr + left_ptr) / 2;
        if numbers[mid] > numbers[right_ptr] {
            left_ptr = mid + 1;
        } else {
            right_ptr = mid;
        }
    }

    numbers[left_ptr]
}

Time Complexity: $O(log n)$
Runtime on LeetCode: $0$ms

This was quite simple, though I couldn’t think of any other approaches nor did I find any other approaches after a really brief look at LeetCode discussions. But if you have any ideas, feel free to contribute!