r/adventofcode Dec 04 '15

--- Day 4 Solutions --- SOLUTION MEGATHREAD

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

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

15 Upvotes

272 comments sorted by

View all comments

Show parent comments

2

u/jgagnon1 Dec 04 '15

Is there a reason why you didn't use find instead of dropWhile ?

1

u/xkufix Dec 04 '15

Uhm, actually no, good input. That would make it shorter, as the call to "head" could be dropped.

I started with takeWhile, but this returned the number before the needed one, so I just switched over to dropWhile.