C++
1 class Solution { 2 public: 3 int minNumberInRotateArray(vector<int> arr) { 4 int len = arr.size(); 5 if (len == 0) return 0; 6 int ret = arr[0]; 7 for (int i = 1; i < len; i++) { 8 if (arr[i] < ret) return arr[i]; 9 } 10 return ret; 11 } 12 };
本文转自ZH奶酪博客园博客,原文链接:http://www.cnblogs.com/CheeseZH/p/5112873.html,如需转载请自行联系原作者