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 …
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.
This is a fantastic use case for
Array. We can again define our custom datatype and write a
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 …
We generalize the problem to finding
n integers that sum up to
everything in Haskell, this function will be recursive in nature and we will
need to provide it 4 arguments.