python-solution


  • -1
    J
    class Solution(object):
        def firstMissingPositive(self, nums):
            if len(nums) == 0:
                return 1
            a = [False]*(max(nums)+1)
            for i in nums:
                if i > 0:
                    a[i-1] = True
            return a.index(False) + 1
    

Log in to reply
 

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