1st December solution - Advent of Code 2020 - swift

As part of Advent of Code (adventofcode.com) each day there are two programming tasks to be solved. All solutions are listed here.

I am writing the solutions in Swift with the Playground environment in xCode.

Tasks - 1st December 2020

  1. In a list of numbers find two numbers, which add up to exactly 2020 and take their product.

  2. In a list of numbers find three numbers, which add up to exactly 2020 and take their product.

The data variable is an array of the list of numbers given by Advent of Code, which is individual for each user.

Here is the solution:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview