class Solution:
    def minNumberDisappeared(self , nums: List[int]) -> int:
        # write code here
        n = len(nums)
        # 原地哈希
        # nums[i] < 0 表示 i+1 出现过
        # 为排除原有负数的影响,将所有负数置为 n+1
        for i, num in enumerate(nums):
            if num <= 0:
                nums[i] = n + 1
        for num in nums:
            x = abs(num)
            if x <= n:
                nums[x-1] = -abs(nums[x-1])
        
        for i, num in enumerate(nums):
            if num > 0:
                return i + 1
        return n + 1