80. Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates":  What if duplicates are allowed at mosttwice?
For example, 
Given sorted arraynums=[1,1,1,2,2,3],
Your function should return length =5, with the first five elements ofnumsbeing1,1,2,2and3. It doesn't matter what you leave beyond the new length.

不要想着把数原封不动的颠倒顺序, 只要在返回长度范围内的数组是对的, 后面的值无所谓

80. Remove Duplicates from Sorted Array II_第1张图片

你可能感兴趣的:(80. Remove Duplicates from Sorted Array II)