[Python] Recursive binary search, explained
In fact this problem is very similar to problem 0033, but here we need to find not target element, but minimum. We can use exactly the same logic:\n\n1. if nums
In fact this problem is very similar to problem **0033**, but here we need to find not target element, but minimum. We can use exactly the same logic:\n\n1. `if nums[end] < nums[mid]`, this means that minimum we are looking for is situated in the right half.\n2. `elif nums[end] > nums[mid]` means that minimum we are looking for is situated in the left half.\n3. `if end - start <=  1` means that we have interval of length `1` or `2`, so we can directly check minimum.\n\nAlso here I did it in recursive, not iterative way just for the purpose of exercise.\n\n#### Complexity\nIt is `O(log n)` for time and space.\n\n#### Code\n```python\nclass Solution:    \n    def findMin(self, nums):\n        def dfs(start, end):\n            if end - start <=  1:\n                return min(nums[start], nums[end])\n\n            mid = (start + end)//2\n            if nums[end] < nums[mid]:\n                return dfs(mid + 1, end)\n            elif nums[end] > nums[mid]:\n                return dfs(start, mid)\n\n        return dfs(0, len(nums) - 1)\n```\n\nIf you have any questions, feel free to ask. If you like solution and explanations, please **Upvote!**
['Binary Search']