153. Find Minimum in Rotated Sorted Array

The solution is quite straightforward. The minimum must be the pivot, so simply use binary search to partition the range into two parts:

t = nums.back()
[begin, lower_bound) > t
[lower_bound, end) <= t

Here is the code:

class Solution {
int findMin(vector<int>& nums) {
if (nums.empty()) {
return 0;
} else if (nums.front() < nums.back()) {
return nums.front();

const auto pivot = nums.back();
const auto iter = std::lower_bound(nums.begin(), nums.end(), pivot, [](const int a, const int b){
return a > b;

return *iter;