81. Search in Rotated Sorted Array II
// Approach 1 Linear Search
class Solution {
public:
bool search(vector<int>& nums, int target) {
for(int i=0;i<nums.size();i++){
if(nums[i]==target)
return true;
}
};
Approach 2 Binary Search
First find pivot and select the portion where to move
Comments
Post a Comment