二分查找和删除元素【双指针】

class Solution {
public:
    int search(vector& nums, int target) {
    
      int left=0;
      int right=nums.size()-1;
      while(left<=right)
      {
         int mid=(left+right)/2;
         if(target>nums[mid])
              left=mid+1;
           else if(target
class Solution {
public:
    int removeElement(vector& nums, int val) {
    int left=0;
    int right=0;
    for(;left

你可能感兴趣的:(算法,leetcode,数据结构)