Easy and simple Approach | Beats 100%
Intuition\nThe problem asks to find the minimum element in a rotated sorted array. The idea is to use binary search to efficiently find the minimum element. The
# Intuition\nThe problem asks to find the minimum element in a rotated sorted array. The idea is to use binary search to efficiently find the minimum element. The key observation is that the minimum element will always be on the side where the rotation occurred. By comparing the middle element with the end element, we can determine which side to search.\n\n# Approach\nThe approach is to use binary search to iteratively narrow down the search space. We maintain two pointers, `start` and `end`, representing the current search range. In each iteration, we calculate the middle index (`mid`) and compare the value at `mid` with the value at `end`.\n\n- If `nums[mid] > nums[end]`, it means the minimum element is on the right side of `mid`, so we update `start = mid + 1`.\n- If `nums[mid] <= nums[end]`, it means the minimum element is on the left side of `mid` or could be `mid` itself, so we update `end = mid`.\n\nWe continue this process until `start` is equal to `end`, and at that point, we have found the minimum element.\n\n# Complexity\n- Time complexity: $$O(\\log n)$$ - Binary search is used, which halves the search space in each iteration.\n- Space complexity: $$O(1)$$ - Constant space is used as we only have a few variables.\n\n# Code\n```java\nclass Solution {\n    public int findMin(int[] nums) {\n        int start = 0;\n        int end = nums.length - 1;\n\n        while (start < end) {\n            int mid = start + (end - start) / 2;\n            if (nums[mid] > nums[end]) {\n                start = mid + 1;\n            } else {\n                end = mid;\n            }\n        }\n        return nums[start];\n    }\n}\n```\n\nThe provided code implements the described approach and efficiently finds the minimum element in the rotated sorted array.
['Java']