r/adventofcode • • Dec 14 '17

SOLUTION MEGATHREAD -๐ŸŽ„- 2017 Day 14 Solutions -๐ŸŽ„-

--- Day 14: Disk Defragmentation ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Need a hint from the Hugely* Handyโ€  Haversackโ€ก of Helpfulยง Hintsยค?

Spoiler


[Update @ 00:09] 3 gold, silver cap.

  • How many of you actually entered the Konami code for Part 2? >_>

[Update @ 00:25] Leaderboard cap!

  • I asked /u/topaz2078 how many de-resolutions we had for Part 2 and there were 83 distinct users with failed attempts at the time of the leaderboard cap. tsk tsk

[Update @ 00:29] BONUS


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!

11 Upvotes

130 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Dec 14 '17

Cool, and as usual you're way faster there than me :P, I was thinking finally I'm the first with elixir, but no.

I used a set of coordinates for saving my used blocks, and then I deleted each region out as I saw it, it worked pretty well, but I think the recursion was blooming out quite a bit :)

here is mine

1

u/Axsuul Dec 14 '17

Hey there good seeing you my Elixir brother/sister! Thatโ€™s a pretty cool strategyโ€”but wouldnโ€™t you need to see the whole grid after it was built out in order to determine the regions?

1

u/[deleted] Dec 15 '17

No, not really, what I'm doing there, is that I pop one coordinate off of my set, and delete their neighbours recursively from the set, and then count one region, and recurse over that until the set is empty :)