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

  1. Find all invalid tickets and sum up all the invalid field values.

  2. Match the rules to the order of the values on the ticket and multiply all fields of my ticket starting with "departure".

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

The lines variable is an array of lines in the txt files given to each member by Advent of Code, which is individual for each user.

The solutions are a continuation of each other so the solutions are not split. Here is the solution:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview

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

A game is played a number of rounds. The game goes as follows: The subsequent number is the number of rounds since the currentNumber occurred last.

  1. Last number after 2020 rounds.

  2. Last number after 30_000_000 rounds.

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

The startingNumbers variable is an array of numbers given to each member by Advent of Code, which is individual for each user.

The solutions only differ in the roundEnd variable. Here are the solutions:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview

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

  1. Applying a bitmask to a binary value and storing them at specific memory adresses. Sum up all values in memory.

  2. Applying a bitmask to memory addresses and storing them at these. Sum up all values in memory.

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

The lines variable is an array of string containing all lines of the txt file given each member by Advent of Code, which is individual for each user.

Here are the solutions:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview