Share my short and easy understand C code


  • 0
    A
    int removeDuplicates(int* nums, int numsSize) {
       int j=0;
       int i;
       int standard= nums[0]+1;
       if(numsSize<=0) return 0;
       for(i=0;i<numsSize;i++)
       {
       	 	if(nums[i] == standard)
    			continue;
    		else
       	 	 {
       	 	 	nums[j++]= nums[i];
       	 	 	standard = nums[i];
       	 	 } 
       }
       return j;
    }

Log in to reply
 

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