Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra mem
原文:Faster Alternative to PHP’s Array Unique Function 概述 使用PHP的array_unique()函数允许你传递一个数组,然后移除重复的值,返回一个拥有唯一值的数组.这个函数大多数情况下都能工作得很好.但是,如果你尝试在一个大的数组里使用array_unique()函数,它会运行地慢一些. 有一个比较好而且更快的函数array_flip()来替代使用array_unique()函数来创建唯一的数组.这个魔法般的函数会交换数组里面每一个元素的键