153: Beats 91.70% Solution with step by step explanation
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nThis solution also uses binary search to find the minimum element in the 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nThis solution also uses binary search to find the minimum element in the rotated sorted array. It initializes two pointers, left and right, to the beginning and end of the array, respectively. It then repeatedly compares the element at the midpoint of the array to the element at the end of the array, and updates the pointers accordingly until the minimum element is found.\n\nThe time complexity of this solution is O(log n), since binary search is used. The space complexity is O(1), since only constant space is used.\n\n# Complexity\n- Time complexity:\nBeats\nBeats\n55.81%\n\n- Space complexity:\nBeats\n55.81%\n\n# Code\n```\nclass Solution:\n    def findMin(self, nums: List[int]) -> int:\n        left, right = 0, len(nums) - 1\n        while left < right:\n            mid = left + (right - left) // 2\n            if nums[mid] > nums[right]:\n                left = mid + 1\n            else:\n                right = mid\n        return nums[left]\n\n```
['Array', 'Binary Search', 'Python', 'Python3']