share my python solution


  • 0
    W

    class Solution(object):
    def firstMissingPositive(self, nums):
    """
    :type nums: List[int]
    :rtype: int
    """

        def __findPositiveNumber(nums):
            if ( not nums ):
                return 1
            
            N = max(nums)
            
            for i in range(1,N+1) :
                if (i not in nums):
                    return i
            return N+1
        
        return __findPositiveNumber(nums)

Log in to reply
 

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