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

  1. From a given number, find the next number, which divided by a number from a list, has a remainder of 0.

  2. Find the starting number where from that point onwards, all the numbers in the list are consecutive divisors of that number.

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

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

Movement instructions are given:

  1. Calculate the manhattan distance to the original location.

  2. Instructions are relative to a waypoint. Calculate the manhattan distance to the original location.

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.

Both solutions are very similar. Here are the solutions:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview

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

Given is a grid of seats where some are occupied, some are filled and on some there is no seat. There are rules for the progression of each iteration.

  1. Count number of occupied seats after another iteration doesn't change the seat plan.

  2. Rules changed compared to 1. Count number of occupied seats after another iteration doesn't change the seat plan.

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

The grid 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.

Both solutions are very similar. Here are the solutions:

Overview of all solutions of 2020:

Advent of Code 2020 Solutions Overview