4ms C++ binary search solution with short explanation
The idea is to binary search for the minimum. If the midpoint of an interval is larger than the right endpoint, the minimum must be in the right half of the int
The idea is to binary search for the minimum. If the midpoint of an interval is larger than the right endpoint, the minimum must be in the right half of the interval. If not, the minimum is in the left half, but may be the midpoint itself (so we keep the midpoint in the active search interval in this case).\n\n    class Solution {\n    public:\n        int findMin(vector<int> &num) {\n            int L = 0, U = num.size() - 1;\n            while (L < U) {\n                int M = L + (U - L) / 2;\n                if (num[M] > num[U]) {\n                    L = M + 1;\n                } else {\n                    U = M;\n                }\n            }\n            return num[L];\n        }\n    };
['C++']