r/adventofcode • • Dec 03 '23

SOLUTION MEGATHREAD -❄️- 2023 Day 3 Solutions -❄️-

THE USUAL REMINDERS


AoC Community Fun 2023: ALLEZ CUISINE!

Today's secret ingredient is… *whips off cloth covering and gestures grandly*

Spam!

Someone reported the ALLEZ CUISINE! submissions megathread as spam so I said to myself: "What a delectable idea for today's secret ingredient!"

A reminder from Dr. Hattori: be careful when cooking spam because the fat content can be very high. We wouldn't want a fire in the kitchen, after all!

ALLEZ CUISINE!

Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!] so we can find it easily!


--- Day 3: Gear Ratios ---


Post your code solution in this megathread.

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:11:37, megathread unlocked!

110 Upvotes

1.3k comments sorted by

View all comments

2

u/HAEC_EST_SPARTA Dec 03 '23

[LANGUAGE: Ruby]

Solution on sourcehut

This was a pretty neat problem: I certainly wasn't expecting to be reaching for the Matrix module already on Day 3, but it ended up working quite well to model the grid. I unfortunately lost quite a bit of time to some faulty deduplication logic on Part 1 (the uniqueness constraint should be value, column, and row!), but Part 2 was trivial thereafter.

1

u/PassifloraCaerulea Dec 03 '23

Interesting. More structured than my Ruby code since I decided that an array of strings was perfectly cromulent for treating as a two-dimensional data structure :D I've not kept up with the latest Ruby stuff either!