Created
May 9, 2022 09:42
-
-
Save theabbie/0510e3effcd8e43502d69be11e58b408 to your computer and use it in GitHub Desktop.
First Missing Positive
This file contains hidden or 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
class Solution: | |
def first_missing_positive(self, a): | |
a = set(a) | |
a.add(0) | |
for i in range(1, max(a) + 2): | |
if i not in a: | |
return i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment