Unable to load image
Reported by:

rDrama Advent of Code day 9: No Edition

Sorry I'm in a hospital waiting room just throwing this out quick

Summary for those just joining us:

Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!

Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app

What did you think about today's problem?

https://adventofcode.com/2023

Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)

37
Jump in the discussion.

No email address required.

Really fricked this one up, time wise. The one time I'm awake at 5 too :marseysad: .

https://i.rdrama.net/images/1702101808520717.webp

Jump in the discussion.

No email address required.

@TriHard What you got today?

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/1702140651199154.webp

My solution is slightly smaller but not as memory-efficient. :marseyshrug:

Jump in the discussion.

No email address required.

Nice. I looked for diff in the stdlib but was disappointed to find nim's diff is a line diffing algorithm for text.

Jump in the discussion.

No email address required.

Smaller improved version:

https://i.rdrama.net/images/17021555184976883.webp

This uses a special parameter called a sink parameter. From the Nim manual:

To move a variable into a collection usually sink parameters are involved. A location that is passed to a sink parameter should not be used afterward. This is ensured by a static analysis over a control flow graph. If it cannot be proven to be the last usage of the location, a copy is done instead and this copy is then passed to the sink parameter.

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.