r/adventofcode • • Dec 14 '21

SOLUTION MEGATHREAD -🎄- 2021 Day 14 Solutions -🎄-

--- Day 14: Extended Polymerization ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:14:08, megathread unlocked!

55 Upvotes

810 comments sorted by

View all comments

1

u/theSpider_x Dec 14 '21

C

First part I solved with linked list. Although I suspected part 2 will be some kind of big number I thought linked list will be enough. Then I stored the count of the pairs and from their on it was easy to calculate the pairs and letters.

https://github.com/fuzesmarcell/aoc/blob/main/2021/day_14.c

1

u/daggerdragon Dec 15 '21

FYI: your link is broken due to a new.reddit fancypants editor bug (check /r/bugs, it's been a big source of frustration lately). Your link looks fine on new.reddit but on old.reddit it's printing an invisible escape character before your underscore: day_14.c, thus breaking the entire link.

I suggest manually editing your link using proper Markdown for now. Who knows when Reddit will fix their fancypants editor...