# Middle-题目47：80. Remove Duplicates from Sorted Array II

Follow up for “Remove Duplicates”:
What if duplicates are allowed at most twice?

Easy-题目29，这次允许一个元素最多出现两次。

int removeDuplicates(int* nums, int numsSize) {
int start = 0;
for(int i = 0;i < numsSize;i++) {
if(i == 0 || i == 1)
nums[start++] = nums[i];
else {
if(nums[i] != nums[start-2])
nums[start++] = nums[i];
}
}
return start;
}

8ms，beats 11.11%,众数8ms,87.30%
Cmershen的碎碎念：

#### Remove Duplicates from Sorted Array II -- LeetCode

2014-04-23 08:39:29

#### LeetCode(80) Remove Duplicates From Sorted Array II

2015-01-11 03:55:11

#### Remove Duplicates from Sorted Array [python解]

2017-07-24 19:18:55

#### LeetCode 26 — Remove Duplicates from Sorted Array（C++ Java Python）

2014-02-23 15:12:20

#### 26. Remove Duplicates from Sorted Array (python)

2016-10-30 15:58:23

#### Remove Duplicates from Sorted Array -- LeetCode

2014-02-27 05:12:22

#### LeetCode 80. Remove Duplicates from Sorted Array II 解题报告

2016-02-19 13:42:36

#### Remove Duplicates from Sorted List II -- LeetCode

2014-04-24 08:33:10

#### 82. Remove Duplicates from Sorted List II Leetcode Python

2015-02-05 11:48:11

#### LeetCode Remove Duplicates from Sorted Array(C语言O(n)解法)

2015-03-10 15:03:38