10th 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 - 10th December 2020

Given is a list of numbers.

  1. Count differences between numbers in list.

  2. Count number of arrangments when differnces of 1, 2, 3 are allowed and any number can be left out.

For a more detailed description of the tasks check this out.

The numbers variable is an array of integers containing a set of numbers each member 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

9th 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 - 9th December 2020

Given is a list of numbers.

  1. Find the first number where no two numbers of the previous 25 numbers sum up that number.

  2. Find the first contiguous set of numbers where the sum matches the number found in the first task. Then sum up the smallest and the largest number in that set.

For a more detailed description of the tasks check this out.

The numbers variable is an array of integers containing a set of numbers each member 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