Day 5

The problem asks us to convert a binary representation of the row number and seat number into its actual number. We can choose to over represent the data as follows.

More …

Day 4

To start this day off, we copy our little parser from day 4, but we don’t need all the parsing logic. We can just treat each answer set as a list of String, because each String represents a single person’s answers.

More …

Day 3

This is a fantastic use case for Array. We can again define our custom datatype and write a Read instance as follows.

More …

Day 2

Both parts of the problem ask us to count how many passwords satisfy some validation function based on a policy. We create a datatype for a password and its associated policy as follows.

More …

Day 1

We generalize the problem to finding n integers that sum up to t. As everything in Haskell, this function will be recursive in nature and we will need to provide it 4 arguments.

More …