My c# solution, no sum


  • 0
    R
    public class Solution {
    public int MissingNumber(int[] nums) {
        Array.Sort(nums);
        int rt=-1;
        for(var i=0;i<nums.Length;i++) 
            if(nums[i]!=i) {
                rt=i;
                break;
            }
        return rt==-1?nums.Length:rt;
    }
    

    }


Log in to reply
 

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