Safe HaskellNone

Day25

Description

General - Interesting one. Struggled to read this right and get all of the numbers/concepts (value, subject, key, ...) right. At least the parsing of the input is easy ...

Main insight was that you can calculate the next value/subject from the previous one with a loop size of 1. And this will obviously speed up the brute forcing of the loop size.

Part 1 - Brute force the card loop size and use it to calculate the door encryption key.

Part 2 - Happy Holidays!!!

Synopsis

Documentation

type Key = Int #

type Keys = (Key, Key) #

input :: String -> Keys #

read the input file.

transform :: Int -> Int -> Int -> Int #

transform a subject number.

brute :: Int -> Int -> Key -> Int #

brute force the public key to get the loopSize.

part1 :: Keys -> Int #

solve part1.

part2 :: Keys -> Int #

solve part2.