首页 > 代码库 > Leetcode026. Remove Duplicates from Sorted Array

Leetcode026. Remove Duplicates from Sorted Array

waterclass Solution {public:    int removeDuplicates(vector<int>& nums) {        for(vector<int>::iterator it=nums.begin();it!=nums.end();)        {            int cur=*it;            it++;            while(it != nums.end() && *it == cur)nums.erase(it);        }        return nums.size();    }};

 

Leetcode026. Remove Duplicates from Sorted Array