ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2025 Day 9 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 9 of the Advent of Code - https://adventofcode.com/2025/day/9

25 REPLIES 25
DaisukeTsuchiya
14 - Magnetar
14 - Magnetar

I spent two hours debugging issue.

Spoiler
In P1, I simply generated all combinations and calculated the area of each rectangle.

For P2, I initially struggled with sorting the 496 input points, not realizing they were already ordered sequentially to form a continuous polygon. This oversight cost me significant time in constructing the polygon. Moreover, the Spatial Match Tool produced inaccurate results for the largest area, forcing me to visually inspect and confirm the correct answer. To top it off, I spent about another two hours only to discover that my area calculation formula was incorrect.

スクリーンショット 2025-12-09 195609.jpg





DataNath
17 - Castor
17 - Castor

Pretty nice challenge today considering we're on Day 9! That is... (spoiler)

 

 

Spoiler
If you're not a complete idiot that spends 1.5 hours debugging spatial processing just to notice that your area calc isn't correct.

Shoutout @Hub119 for the Spatial Process prompt - didn't click on to what he was ranting about in the WhatsApp chat until I ran into that brick wall myself!

Workflow.png

 

 

AkimasaKajitani
17 - Castor
17 - Castor

Part of the problem was difficult to understand, but it seems I took a long detour because I didn't read the problem carefully.

 

Spoiler
In order to create the outer polygon, I went to the trouble of finding combinations, rearranging the lines, and working hard to create the polygon, but all I needed to do was create it in the original order.

 

My 1st workflow.

Spoiler
AoC_2025_09_7.png


Macro 

AoC_2025_09_5.png

After reading community.

Spoiler

AoC_2025_09_9.png

 

 

Goddenra
8 - Asteroid

Was determined to avoid using the Spacial tools, went down a complete rabbithole by building out a grid using formulas, realised the maths would never allow that to work, gave up and force myself to use Spacial.
Really wish I had, as it took a fraction of the time. And isn't that what AoC is supposed to be about, using things you don't typically use.


Spoiler
Thanks to those noting that Spacial Match didn't generate correct result, lost a lot of time on that, before taking Spacial Process approach.

Couldn't initially figure out how to generate the rectangle from the two points, before I learned about the bounded rectangle formula (thanks Google!).
Goddenra_0-1765291948098.png

 

mmontgomery
11 - Bolide
11 - Bolide

Day 9

Spoiler
Thank god for spatial tools!
P1: Rather easy brute force by appending all points to each other then taking area of min/max points on rows/columns
P2: Took a bit on approach but landed on spatial. First I created a Sequence Polygon of all the points (don't forget to add the initial point to the end to close the loop). Then I created a bounding rectangle of point a, point b then point a again. From there, I did a spatial match where target within universe to see which bounding rectangles fit into the sequence polygon universe. From there, take the max area and bam, there you have it!
Day9.jpg
ScottLewis
11 - Bolide

Went around in circles trying to get a math and macros solution before recalling that this was a spatial tool first.

The math solution produced some delightful outputs for the test data and then overflowed the temp directory on my hard drive with the actual data.

 

Came around for some help as spatial is something I don't normally have reason to do.

 

Things that tripped me up:

 

Spoiler
Dividing points by 1000000 if you use formulas to create them rather than the tools. I don't understand it, but I know it to be true.

That you want the Nulls out of spatial processing, not the non-nulls. The Nulls are the ones where nothing was left over when you cut the polygon of red points out of the rectangle. I remember something on one of these discussions where a wiser spatial user than me made the point that we do ourselves no favors by calling things the Universe when it's really just another polygon.

Trying to use spatial match instead of spatial processing. It is interesting that one of the tools is concrete and the other is fuzzy.
lwolfie
11 - Bolide

I kept changing too many things on the spatial tools at one time.  So it kept not working. :)

WirkKarl
8 - Asteroid

These Advent of Code challenges are always a fun way to test different approaches in Alteryx. Looking forward to seeing how others tackle it and comparing solutions.

Stosh
7 - Meteor

Day 9 is officially in the books! This was a really cool challenge, and yet another opportunity to get some practice with some seldom-used tools. We are now 3/4 done with AoC!

 

My Solutions

Spoiler
Stosh_0-1765318197312.png

 

My Reflection:

Spoiler
Part 1 was super easy. Brute force took me all the way home. I made a list of every possible combination, calculated their areas, and isolated the largest one. Honestly, I probably could have skipped the part where I remove pairs of the same point, but oh well! At least it proves I am aware of the issues involved with cartesian joining a table to itself. 

Part 2 was where things heated up, as usual! I heard rumblings all day about how spatial tools are super useful here (Given the fact we are working with a grid, this makes sense) but that Spatial Match was giving people trouble. That being said, it was my original plan while I was dreaming up answers to the question so I just HAD to try it. I started with the same combination of every pair of points and began calculating the missing corner points. Once I had those, I created a square polygon for each pair to act as my Targets. Then, I sequenced the original list of points and created a sequence polygon to act as my Universe. When I got a wrong answer (too high), I was like: "Hmm, the correct one must be right on the edge or something... I know! I will add a buffer to my sequence polygon!" (You fool, they said too high, and buffer would only make that worse!!) Anyways, a few more fumbles with spatial match occurred before I finally decided to scrap it. I almost scrapped spatial analysis entirely, but I had already come so far that I forced myself to at least drag a bunch of other spatial tools onto the canvas to see if it sparks any inspirations. Lucky for me, I eventually landed on the Spatial Process tool and realized that I might be able to work the other way around. That is to say, if removing the 'Universe' from a target polygon leaves you with nothing left, that means all of the target polygon was within the green/red squares, and that the pair in question is valid for the problem. After I made that discovery, I was free and clear!

Overall, this problem was really cool, and I am glad we are entering into the days where the tools become super niche. Even more so, I am glad to be a part of the community that helps me so much along the way. See you all tomorrow!

 

Erin
11 - Bolide

Since I take to Spatial tools about as well as vampires take to garlic, I only used one! And it wasn't the spatial match tool either!

 

Spoiler
So I only technically used one spatial tool to create a polygon, but I used a bunch of spatial functions! 
Day9.png
Pt 1 -
Pretty similar to others, I did a cartesian join, removed dupes, calculated the area and found the max area.

Pt 2 -
Only because I had the advantage of reading WhatsApp comments about how spatial match tool was not being friendly (thanks @Hub119, your frustration saved me today!), I decided to cut my little rectangles from the "Big Spatial Obj" (I'm so technical), and then calculate the area of the cut object. I only kept where the cut object area was null or 0. For funsies, I did a within formula too - but that formula didn't always work. The cut objects with a 0 area  were falsely excluded from my within formula. 
Labels
Top Solution Authors