RSS
 

Advent Of Code: Day 1

02 Dec 2015
CTF: Advent Of Code
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

 

Leave a Reply