A simple C solution [Accepted]

  • 0
     * Return an array of size *returnSize.
     * Note: The returned array must be malloced, assume caller calls free().
    int* findErrorNums(int* nums, int numsSize, int* returnSize) {
        int a[10001]={0};
        int *result=(int*)malloc(sizeof(int)*2);
        for(int i=0;i<numsSize;i++)
        for(int i=1;i<=numsSize;i++)
            {result[1]=i;return result;}
        return result;

Log in to reply

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