Python Missing Integer
def missing_integer(a: list[int]) -> int:
min_val = 1
for v in sorted(set(a)):
if v > 0:
if min_val != v:
break
min_val += 1
return min_val
This records the positive numbers that exist, then returns the smallest positive value that is still missing.