80. Remove Duplicates from Sorte

2016-12-27  本文已影响0人  我是你的果果呀

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.

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

上一篇 下一篇

猜你喜欢

热点阅读