Concise accepted 12 ms c solution


  • 2
    H
    int removeDuplicates(int* nums, int numsSize) {
        int i,j;
        for(i=0,j=0; j<numsSize; j++) {
            if(nums[i] != nums[j]) {
                i = i+1;
                nums[i] = nums[j];
            }
        }
        return (i+1)>j ? j : (i+1);
    }

Log in to reply
 

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