public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bernice Southey <[email protected]>
To: Greg Sabino Mullane <[email protected]>
Cc: [email protected]
Subject: Re: Advent of Code Day 8
Date: Tue, 16 Dec 2025 16:19:21 +0000
Message-ID: <CAEDh4nyVW-Q_-F2S8m5o+uVh53ea6FCSLXYJEqBu_8bRZy5YYg@mail.gmail.com> (raw)
In-Reply-To: <CAKAnmmKe569wZRFAEmzpxHPJeVE340iP0Qf3G+sJMgf7HgedRQ@mail.gmail.com>
References: <CAEDh4nzEm2e=yFnC3UWjMVknjMvHsSX0nVtYdVZJK9NAMMaKVg@mail.gmail.com>
<CAKAnmm+vumTRt8WB0OLsy7cVbYqdPW1m1EEOT26MCFPUd0JcOg@mail.gmail.com>
<CAEDh4nxpTobNoV8=6hqJm3gP2i6-=RvD9R9d1zh=6VrOta3gSA@mail.gmail.com>
<CAKAnmmKe569wZRFAEmzpxHPJeVE340iP0Qf3G+sJMgf7HgedRQ@mail.gmail.com>
Greg Sabino Mullane <[email protected]> wrote:
> As I said, I'm trying to solve them in a single statement. Recursive CTEs, CASE, and creative use of JSON can get you a long way. Here's my day 7, which runs slow compared to other languages, but runs as a single SQL statement and no plpgsql, and I think is a good solution:
This took some head scratching but is very clever. I see there are
plenty of tricks for working around the limitations of recursive CTEs.
If you do ever get to 10, I'd be very curious to see your answer. I
used a recursive CTE for part 1, but cheated by limiting the recursion
to a fixed big enough number. I've been struggling with branch
pruning. I'm also interested in how you solve 11, if you use a
recursive CTE trick for part 2. The no aggregates drove me to a for
loop.
I was planning to check out your blog for 2022 if I ever caught up on
old AoCs, but 10 years is a bit steep. Now I'm thinking if I should
just read it for the tricks, and skip the puzzling.
view thread (5+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Advent of Code Day 8
In-Reply-To: <CAEDh4nyVW-Q_-F2S8m5o+uVh53ea6FCSLXYJEqBu_8bRZy5YYg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox