Minimum in rotated array

Write codeMedium18 minMeta and Amazon style

Your task

An ascending array of distinct integers was rotated at an unknown pivot. Given the rotated array nums, return its minimum element in O(log n) time. Array length up to 5000; the array may not be rotated at all.

Examples

find_min_rotated(nums: list[int]) -> int
Example 1
Inputfind_min_rotated([3, 4, 5, 1, 2])
Output1