input: Write a function to find two numbers in an array that add up to a target value.
  assert two_sum([1, 2, 3, 4, 5], 9) == [4, 5]
  assert two_sum([10, 20, 30, 40, 50], 70) == [20, 50]
  assert two_sum([3, 7, 11, 15], 18) == [3, 15]
  assert two_sum([1, 2, 3], 5) == [2, 3]
output: def two_sum(nums, target):
      num_to_index = {}
      for num in nums:
          complement = target - num
          if complement in num_to_index:
              return [complement, num]
          num_to_index[num] = True