Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syedsaqibali/fe52c089f5948b42508889f96c506328 to your computer and use it in GitHub Desktop.
Save syedsaqibali/fe52c089f5948b42508889f96c506328 to your computer and use it in GitHub Desktop.
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
len_nums = len(nums)
missing_ints = list(range(1, len_nums+2))
for i in nums:
if i <= len_nums and i > 0:
missing_ints[i-1] = None
for i in missing_ints:
if i != None:
return i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment