r/adventofcode • u/daggerdragon • Dec 04 '16
SOLUTION MEGATHREAD --- 2016 Day 4 Solutions ---
--- Day 4: Security Through Obscurity ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
CONSTRUCTING ADDITIONAL PYLONS IS MANDATORY [?]
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
17
Upvotes
View all comments
Show parent comment
2
u/mlruth Dec 04 '16
It probably wouldn't make much if any difference on collections like this, but if you use a list, it might be beneficial to use a list.view before combining the other operations to prevent the JVM from having to create new lists with all elements after each operation. I was able to use foldLeft to do the filtering, mapping, and summation into one list traversal for part 1.