def first_missing_positive_integer(array: list[int]) -> int:
	"""
	Returns the first missing positive integer for a given array
	using the above algorithm
	:param array: The input array
	:return: The first missing positive integer
	"""
	# Remove negative numbers and identify the minimum value
	array = [val for val in array if val >= 0]
	min_val = min(array)

	# Turn it into a set in constant memory
	array_set = set()
	while len(array) > 0:
		val = array.pop()
		array_set.add(val)
	
	# Identify the hole by looking up elements starting from
	# the minimum value
	hole = min_val + 1
	while hole in array_set:
		hole += 1

	return hole