The best I can do on C


  • 0
    B
    int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize) {
        int exist[numsSize+1];
    
        memset(exist, 0, sizeof(exist));
    
        for(int i = 0; i < numsSize; i++)
            exist[nums[i]]++;
    
        for(int i = 1; i <= numsSize; i++)
            if (!exist[i]) {
                nums[exist[0]] = i;
                *returnSize = ++exist[0];
            }
        
        return nums;
    }

Log in to reply
 

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