码迷,mamicode.com
首页 > 其他好文 > 详细

【leetcode】Search in Rotated Sorted Array II

时间:2015-05-02 12:28:06      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

What if duplicates are allowed?

Would this affect the run-time complexity? How and why?

Write a function to determine if a given target is in the array.

 

 1 class Solution {
 2 public:
 3     bool search(vector<int>& nums, int target) {
 4         if(nums.size()==0) return false;
 5 
 6         for(int i=0;i<nums.size();i++)
 7         {
 8             if(target==nums[i])
 9                 return true;
10         }
11         return false;
12     }
13 };

 

【leetcode】Search in Rotated Sorted Array II

标签:

原文地址:http://www.cnblogs.com/jawiezhu/p/4471743.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!