My simple javascript solution


  • 0
    K
    var removeDuplicates = function(nums) {
    for(var i=0;i<nums.length;)//1,1,1
    {
       
        if(nums[i+1]=== nums[i]){
            nums.splice(i, 1);
        }
    
        else i++;
                
        
        
    }
    return i;
    

    };


Log in to reply
 

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