The simplest solution


  • 1
    C
    int removeDuplicates(vector<int>& nums)
    {
        auto endPtr=unique(nums.begin(),nums.end());
        return (endPtr-nums.begin());
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.