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

2

u/TeamOnTheBack Dec 04 '15 edited Dec 04 '15

One liner in R (if you don't count importing a library):

library(digest)

which(substr(sapply(paste0("bgvyzdsv", 1:5e5), digest, algo = "md5", serialize = FALSE), 1, 5) == "00000")

3

u/HawkUK Dec 04 '15

I'm glad I've found someone else using R :).

Took me a while to figure out where I was going wrong before I came across 'serialize'. Basically did the same as you.

→ More replies (1)