1 class Solution { 2 public: 3 int findMin(vector & nums) { 4 int size=nums.size(); 5 if(size==0) 6 return 0; 7 if(size==1) 8 return nums[0]; 9 int index1=0;10 int index2=size-1;11 if(nums[index1]nums[index2])17 {18 index1=middle;19 }20 else21 {22 index2=middle;23 }24 middle=(index1+index2)/2;25 }26 return nums[index2];27 }28 };