RSS
 

Posts Tagged ‘advent of code’

Advent Of Code 2015: Day 6

06 Dec 2015
CTF: Advent Of Code 2015
Link to challenge: http://adventofcode.com
Date Completed: 06 December 2015

The Challenge

Solution

I split up the solutions for part 1 and part 2. Was almost tempted to go for a numpy and scipy sparse matrix solution but a 1000×1000 matrix is small enough for a dense matrix.

Part 1

Part 2

 
No Comments

Posted in Advent Of Code 2015

 

Advent Of Code 2015: Day 5

05 Dec 2015
CTF: Advent Of Code 2015
Link to challenge: http://adventofcode.com
Date Completed: 05 December 2015

The Challenge

Solution

Another quick and simple Python solution!

 
No Comments

Posted in Advent Of Code 2015

 

Advent Of Code 2015: Day 4

04 Dec 2015
CTF: Advent Of Code 2015
Link to challenge: http://adventofcode.com
Date Completed: 04 December 2015

The Challenge

Solution

Because speed was not an issue in this case, I simply used python again to solve the problem. The script is a little slow taking ~10 seconds to compute the answer in my case. A C/C++ solution would be orders of magnitude faster.

 
No Comments

Posted in Advent Of Code 2015

 

Advent Of Code 2015: Day 2

02 Dec 2015
CTF: Advent Of Code 2015
Link to challenge: http://adventofcode.com
Date Completed: 02/12/2015

The Challenge

Solution

This challenge was very simple. I whipped up a short python script that solves it. The use of sorted to get the second smallest integer is not pretty but insignificant with such small numbers.

 
No Comments

Posted in Advent Of Code 2015

 

Advent Of Code 2015: Day 1

02 Dec 2015
CTF: Advent Of Code 2015
Link to challenge: http://adventofcode.com
Date Completed: 01/12/2015

The Challenge

Solution

Before part 2 of the problem was revealed I decided to tackle the problem using the command line. I cam up with the following command:

We echo the input and remove the ) symbol which leaves only ( and we use wc to count the number of  ( symbols which tells us how many times we went to a higher floor. We then subtract his number from the number of times we went to a lower floor (using bash arithmetic) which gives us our answer.

Part 2 of the problem would be annoying to do on the command line so I decided to write a quick python script to solve it. The solution also solves the first part of the problem (lol).

 
No Comments

Posted in Advent Of Code 2015