Pure C solution 12ms


  • 0
    P

    int removeDuplicates(int* nums, int numsSize) {
    int n = 0;
    for(int i = 0; i < numsSize; i++)
    {
    while(nums[n] <= nums[i])
    {
    if(n!=numsSize-1)
    n++;
    else
    return(i+1);
    }
    nums[i+1] = nums[n];
    }
    return numsSize;
    }


Log in to reply
 

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