您的位置:首页 > 其它

【leetcode】Search in Rotated Sorted Array II

2015-05-02 11:27 579 查看
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.

class Solution {
public:
bool search(vector<int>& nums, int target) {
if(nums.size()==0) return false;

for(int i=0;i<nums.size();i++)
{
if(target==nums[i])
return true;
}
return false;
}
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: