a simple c code snippet


  • 0
    int removeElement(int* nums, int numsSize, int val) {
        int res=0;
        for(int i=0; i<numsSize; ++i)
            if(nums[i] != val)
                nums[(++res)-1]=nums[i];
    
        return res;
    }

Log in to reply
 

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