JavaScript


  • 0
    S
    var firstMissingPositive = function(nums) {
      if(nums.length===0) return 1;
        var flag = 1;
        while(nums.indexOf(flag)!==-1){
          flag++;
        }
        return flag;
    };
    

Log in to reply
 

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