My java easy understanding solution


  • 0
    1

    public int missingNumber(int[] nums) {

    	Arrays.sort(nums);
    
    	for (int i = 0; i < nums.length; i++) {
    		if (nums[i] != i)
    			return i;
    	}
    
    	return nums.length - nums[0];
    }

Log in to reply
 

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