Skip to content

Files

Latest commit

 

History

History

2016

Notes on each day's solutions

Completion times 2016

(image by Jo Wood)

Days 5, 14 and 17 used MD5 hashing (used in Day 5 in 2015), exploiting the fact that it is a bit costly to compute and is difficult to invert. In 2017, a custom hashing function with the same properties is used instead.

The first part is just following Cartesian directions.

The second part was a significant variation.

The first part is following directions on a keypad (easier).

The second part was a bit harder.

Checking for triangle sides is a simple list manipulation.

The second part needs transpose and takes.

Finding most common letters, second part shift cipher.

The first part was a simple list search to invert an MD5 hash.

The second part builds an inverted array.

Most and least common letters.

Substring searches.

The second part is incompletely specified. It is not clear that "corresponding" means exactly one.

Rotations of rows and columns of a grid.

The second part involves displaying a bitmap for manual reading.

String expansion.

The second part is incompletely specified: it is crucial that markers must be nested. The solution requires recursion, but fortunately only lengths need be computed.

An asynchonous network, incompletely specified.

After a run of medium-sized problems, this one came as a shock. It is a 3-stage variant of the Jealous Husbands Problem. The first part is to get the implementation correct, but simple methods take far too long for the second part. I did manage to get an answer by using the A* algorithm and a hand-optimized representation, but none of that was necessary, or as fast as exploiting the structure of the problem.

Lesson: merge equivalent states to cut the search space.

A machine simulation.

A cute maze solver using breadth-first search.

Lots of MD5 calls, but otherwise simple.

Easily recognizable as the Chinese Remainder Problem.

Fractal strings of bits.

Cute dynamic maze calling MD5.

An easy iteration.

Two variations on the Josephus problem.

There are fast shortcuts, but brute force with the Haskell Seq container worked when array-based implementations were prohibitively slow.

Merging intervals.

The second part is the inverse of the first. The inverse is not unique on the example, but is on puzzle input.

The second part as specified is very difficult, but the given input is a much simpler case reducing to a 15-puzzle.

Self-modifying code (based of Day 12).

A maze search (Day 13) plus the Travelling salesman problem.

Decompiling of a similar assembly language to Days 12 and 23.