Must Read Binary Search Pattern
Search in Rotated Sorted Array\n81. Search in Rotated Sorted Array II\n153. Find Minimum in Rotated Sorted Array\n\n# Code\n\n\nclass Solution {\n    public sta
33. Search in Rotated Sorted Array\n81. Search in Rotated Sorted Array II\n153. Find Minimum in Rotated Sorted Array\n\n# Code\n```\n\nclass Solution {\n    public static int findMin(int[] arr) {\n        int low = 0, high = arr.length - 1;\n        int ans = Integer.MAX_VALUE;\n        while (low <= high) {\n            int mid = (low + high) / 2;\n\n            // Search space is already sorted,\n            // then arr[low] will always be\n            // the minimum in that search space:\n            if (arr[low] <= arr[high]) {\n                ans = Math.min(ans, arr[low]);\n                break;\n            }\n\n            // If left part is sorted:\n            if (arr[low] <= arr[mid]) {\n                // Keep the minimum:\n                ans = Math.min(ans, arr[low]);\n\n                // Eliminate left half:\n                low = mid + 1;\n\n            } else { // If right part is sorted:\n\n                // Keep the minimum:\n                ans = Math.min(ans, arr[mid]);\n\n                // Eliminate right half:\n                high = mid - 1;\n            }\n        }\n        return ans;\n    }\n}\n\n\n```
['Java']