Skip to content

Instantly share code, notes, and snippets.

@solimanware
Created January 27, 2017 17:43
Show Gist options
  • Save solimanware/fe0fb3d73a68593af3220e151aca76c8 to your computer and use it in GitHub Desktop.
Save solimanware/fe0fb3d73a68593af3220e151aca76c8 to your computer and use it in GitHub Desktop.
/**
* @param {number[]} nums
* @return {number}
*/
var firstMissingPositive = function(nums) {
for (var i =0; i <= nums.length; i++) {
if (nums.indexOf(i+1) === -1){
return i+1
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment