reference:
https://blog.csdn.net/musechipin/article/details/85273856
Title Description: https://leetcode.com/problems/remove-duplicates-from-sorted-array/
{Solution class public: int RemoveDuplicates (Vector <int> the nums &) { IF (nums.size () == 0 || nums.size () ==. 1) return nums.size (); int I =. 1; the while (I <nums.size ()) { IF (the nums [I] == the nums [-I. 1]) nums.erase (nums.begin () + I); the else I ++; } return nums.size (); } }; // better Solution: UNIQUE function faster / ** * @brief UNIQUE () function is removed adjacent the number of repetitions, but one, before use the first sort, * UNIQUE () does not repeat the Deletion element, just put the final duplicate elements, so fitted * erase () can completely remove elements; * / class {soluton public: int RemoveDuplicates (Vector <int> the nums &) { nums.erase (UNIQUE (nums.begin (), nums.end ()) , nums.end); return nums.size(); } };