My C answer, NOT the math one. Easy to understand.

  • -1

    In this question ,we can sort them first and find the missing number very easily!!!

    include <stdio.h>
    include <stdlib.h>
    int cmp(const void a,const void *b)
           return((int )a-(int *)b); 
    int missingNumber(int* nums, int numsSize) 
          for(int i=0; i<numsSize;i++) 
                     { return i; }

Log in to reply

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