点击打开链接
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<cstring>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<limits.h>
#include<assert.h>
#include<sstream>
#define LL long long
#define inf 0x3f3f3f3f
#define mod 1e9+7
using namespace std;
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if(nums.empty()) return 0;
int idx=0,count=0;
for(int i=0;i<nums.size();i++){
if(i>0&&nums[i]==nums[i-1]){
count++;
if(count>=3) continue;
}
else{
count=1;
}
nums[idx++]=nums[i];
}
return idx;
}
};
int main()
{
Solution temple;
return 0;
}