------
## 最终结论
```python
def firstMissingPositive(nums):
    n = len(nums)
    
    # Step 1: Replace negative numbers and zeros with n + 1
    for i in range(n):
        if nums[i] <= 0 or nums[i] > n:
            nums[i] = n + 1
            
    # Step 2: Mark the presence of numbers
    for i in range(n):
        num = abs(nums[i])
        if 1 <= num <= n:
            nums[num - 1] = -abs(nums[num - 1])
            
    # Step 3: Find the first positive index
    for i in range(n):
        if nums[i] > 0:
            return i + 1
            
    # Step 4: If all indices are negative, return n + 1
    return n + 1

# Example usage:
print(firstMissingPositive([1,2,0]))      # Output: 3
print(firstMissingPositive([3,4,-1,1]))   # Output: 2
print(firstMissingPositive([7,8,9,11,12])) # Output: 1
```