Given an array of integers nums containing n distinct numbers taken from 0 to n, find the one number that is missing from the array.
You must implement an algorithm that runs in O(n) time and uses O(n) space.
def missing_number(nums: list[int]) -> int: