Simple c 4 lines


  • 0
    N

    int missingNumber(int* nums, int numsSize)
    {
    int i,sum=0;
    for(i=0;i<numsSize;i++)
    sum+=nums[i];
    return (numsSize+1)*numsSize/2-sum;

    }


Log in to reply
 

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