1 line in C++ using algorithm


  • 1
    class Solution {
    public:
        int removeDuplicates(vector<int>& nums) {
            return distance(nums.begin(), unique(nums.begin(), nums.end()));
        }
    };

Log in to reply
 

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