/** * Note: The returned array must be malloced, assume caller calls free(). */ int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize){ int* hash = (int*)calloc(numsSize+1,sizeof(int)); int i,pst=0; for(i=0; i<numsSize; i++) hash[nums[i]]++; for(i=1; i<=numsSize; i++){ if(!hash[i]) nums[pst++]=i; } *returnSize=pst; return nums; }