r/adventofcode • • Dec 04 '15

SOLUTION MEGATHREAD --- Day 4 Solutions ---

--- Day 4: The Ideal Stocking Stuffer ---

Post your solution as a comment. Structure your post like the Day Three thread.

14 Upvotes

272 comments sorted by

View all comments

Show parent comment

3

u/NihilistDandy Dec 04 '15

I went in a similar direction

{#- LANGUAGE NoImplicitPrelude -#}
import BasePrelude
import Data.Hash.MD5

day4Helper key zeroes = length . takeWhile ((> 16^(32 - zeroes)) . md5i . Str . (key++) . show) $ [0..]

day4part1 = day4Helper "bgvyzdsv" 5
day4part2 = day4Helper "bgvyzdsv" 6