Created
January 27, 2017 17:43
-
-
Save solimanware/fe0fb3d73a68593af3220e151aca76c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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