C Solution Runtime erreor


  • 0
    K

    I have written the following code in C , but its giving runtime error . Could anyone suggest its solution in C language only.

    int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize)
    {

    int temp;
    for(int i=0;i<numsSize-1;i++)
    {
    for (int j=i+1;j<numsSize-i-1;j++)
    {
    if(nums[i] > nums[j])
    {
    temp=nums[i];
    nums[i]=nums[j];
    nums[j]=temp;
    }
    }
    }

    for(int k=0;k<numsSize;k++)
    {
    if(nums[k]!=(nums[k-1]+1))
    {
    int d=nums[k]-nums[k-1];
    for(int j=0;j<(d-1);j++)
    {
    for(int l=nums[k-1]+1; l<nums[k]; l++)
    {
    returnSize[k]=l;
    }
    }

       }
    

    }

    return returnSize;
    }


Log in to reply
 

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