In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2025 Day 3 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

30 REPLIES 30
Malvim
11 - Bolide

I really love Macros. Was able to nail it first time between nailing Sample data versus Real Data.

Part2 Macro captured some Part1 concepts, of course, but expanded to find any quantity of digits you set. So when I set it up to only 2 digits it solved part 1 too.

 

Spoiler
Malvim_0-1764784348163.png

 

Malvim_1-1764784385099.png

 

Malvim_2-1764784407669.pngMalvim_3-1764784867550.png

 

Malvim_4-1764784926582.png

 

Stosh
6 - Meteoroid

Day 3 complete! Cool challenge that definitely scaled up from part 1 --> part 2. Honestly, at this point, I am just happy to still see my name without scrolling on the leaderboards because these are tough!! See you all tomorrow😀

 

My Solutions:

 

Spoiler
Solution
Stosh_3-1764785648350.png

 


Macro used in part 2
Stosh_2-1764785600679.png

 

 

My Reflection:

 

Spoiler
Part 1 of this challenge was super easy. My approach was to simply mark down the order of each battery, find the highest one that wasn't the very last digit, then do the exact same thing except on a limited search window of battery's ordered after the highest one. Piece of cake, no macro needed.

Part 2 definitely had my jaw drop, as I realized I had to either make this a recursive process or copy and paste my original solution 11 more times. As it turns out, some wizards in the community managed to solve this without requiring an iterative macro. I only hope to be half as good as those folks someday! Either way, my iterative macro mimics the process of my part 1 solution very closely, with the steps being hide ineligible batteries at the end of the string that would result in a jolt less than 12 digits, find the highest jolt of all eligible batteries, and limit the future search window to only batteries after the one you just found, then rinse and repeat until you have 12 batteries that result in the highest total jolt. I completed this MOSTLY on my own, though I did take peeks at some solutions because I wasn't able to properly set up the [Iteration Number] logic to stop at the right time and was going to lose my mind. Slightly disappointed about it, but honestly I am more proud that I am able to even get as close as I did completely solo. As someone who can tackle most difficult weekly challenges in under an hour, these have been the new test of strength that I have been searching for, and I really enjoy the battle of trying to solve these puzzles using a tool that isn't necessarily optimized for it, and I can physically feel myself getting better at Alteryx with every star.

 

 

Kenda
16 - Nebula
16 - Nebula
Spoiler
updated with part 2 done. initially had allowed basically every combo to come through but I should've expected that would take way too long so had to put some parameters around it. thankfully there was the stipulation that the length had to be 12 so I could just copy and paste the logic 12 times.

Kenda_0-1764856439445.png

 



 

 

Pilsner
13 - Pulsar

First day with a macro, and the workflows are certainly growing too! In terms of which part was most challenging, I found this one the opposite of yesterday's. I had an idea early on, but it took a little while to build the solution. Looking forward to tomorrow's challenge!

Spoiler
Hopefully, the annotations are visible, but the workflow screenshot had to be a bit more zoomed out today 😊

Pilsner_0-1764791527748.png

 


Part 1

1) As will likely become a common theme, step one was to parse the data to get one value in each row. I created what I called a "Line ID" and "Position ID" so that I knew where each value initially came from. These are effectively an x & y coordinate for each value.

Pilsner_2-1764791753603.png


2) Choosing the battery sounded straight forward enough but then I realised, I needed to make sure I had at least, one battery to the right of my chosen battery, in order to ensure I could make the full bank, of 2 batteries. With this in mind, if I temporarily remove the last battery from my list, then I don't need to worry about having enough left, as I have the temporarily removed one in "reserve". To remove this battery, I took the maximum position ID from the list, then filtered out any battery with that ID.


Pilsner_3-1764792078820.png


3) Now with enough in reserve, I can freely choose, the largest battery, from the remaining list. I used a sort descending and then a sample tool to achieve this.


Pilsner_4-1764792176029.png

 

4) With the first battery per Line ID (aka bank), selected, I now needed to figure out the second battery. The only rule, is that the second battery, must appear after the first one. Translating this into the workflow means that the Position ID of the second battery, must be greater than the position ID of the first battery. Using a join followed by a filter, we can isolate this list.

Pilsner_5-1764792692069.png

 

5) Using the same sort sample trick as before, we can use the list we created, to help find the highest value battery, of those to the right of our first choice.

 Pilsner_6-1764792814219.png



6) Finally, we need to combine the first and second battery values together to get the Joltage per bank. Then simply sum the Joltage to get to the answer. 


Pilsner_7-1764792898529.png

 




Part 2
This is where the iterative comes in, the idea being, each iteration, identified the next battery, in the optimal battery bank sequence. Fortunately, my steps for each iteration were almost identical to the steps taken to solve part one, just this time, they were wrapped in a macro. Step one is still the same as above, but then the data flows straight into my iterative macro:

Pilsner_8-1764793126995.png

Although the steps in the iterative, are almost identical the steps 2- 4 above, Ill briefly explain the changes. 

1) In the original step 2 above, we removed the bottom battery from our list, and kept it in "reserve". This allowed us to choose the greatest battery value, from those that remained. As we are now working with a 12 batterie bank instead of just 2, we need to keep more in reserve. For the first iteration, we need to keep 11, batteries in reserve. Then 10 are reserved in the second iteration, and so on. I achieved this by making a small adjustment to the filter tool, using the engine iteration number.

Pilsner_9-1764793361326.png

2) Step three from above, is exactly the same inside the macro, as it was out. The next difference is simply with the outputs. After step 3 is complete, we have found the best battery per Line ID, so this is then output from the macro.

Like before, the list of batteries is then filtered down so we have only those that appear to the right of the previously chosen batteries. However, at this stage I have also added a statement to remove all records from the loop, on the 12 iteration.

Pilsner_10-1764793613121.png

 

3) Out of the iterative macro, I then get a list of all the chosen batteries with their Line IDs and Position IDs attached.

Pilsner_11-1764793716992.png



4) I used a sort and summarise tool, to concatenate these individual batteries, back into their corresponding banks (Line IDs).

Pilsner_12-1764793774941.png


5) Finally, like in part one, the Joltages are summed to arrive at the final answer.

Pilsner_13-1764793828582.png

 



 

DavidP
17 - Castor
17 - Castor
Spoiler
2025 D3.png2025 D3 macro.png
Samantha_Jayne
Alteryx
Alteryx
Spoiler
The only way I could think about this was all possible combinations then find the max.

I must learn not to try and solve it without a macro. Especially as I didn't want to copy and paste either!! Hilariously stubborn. So macro it was.

AOC - Day 3.png
Samantha Clifton
Alteryx
#alteryxrocks
JeffF
Alteryx
Alteryx

I reworked my copy and paste mess to use an iterative macro. The macro works for both parts.

Spoiler
Day03-JeffF_WithMacro.pngMacro for both partsMacro for both parts
Tokimatsu
12 - Quasar

My first macro in AOC 2025. Unfortunately.

Spoiler
It seems like it could be done without using macros, but that's all for now. 


スクリーンショット 2025-12-04 110150.png

スクリーンショット 2025-12-04 110214.png

 

jrlindem
12 - Quasar

This is where the difficulty really ramped up for me.

 

I solved part 1 with some effort, but not too bad.  Then I got to part 2 and got totally in my head.  You ever have it where you start with something and then just can't get that idea out of your head and it ends up getting in the way?  Well that's what happened to me.  Part 1 was obsessively in my head to the detriment of thinking through part 2.

 

In the end, I studied up on a variety of other's solutions for part 2 and ultimately adapted @gawa's iterative macro (credit where credit is due).  Thank you and nicely done gawa!

 

Here's my solution.  No narrative this time around, my brain is fried after this plus the day job...

 

Spoiler
jrlindem_0-1764815108659.png

 

 

... on to day 4...?  😅

Tokimatsu
12 - Quasar

AoC 2025 Day 3 part 2 tool golf.

 

スクリーンショット 2025-12-04 130249.png

Labels
Top Solution Authors