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 2023 Day 5 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 5 of the Advent of Code - https://adventofcode.com/2023/day/5

32 REPLIES 32
JeffF
Alteryx
Alteryx

Brute force.

Spoiler
2023_AoC_Day5_JeffF.png
starkey
7 - Meteor

@gawa Nice work on this! By far the most elegant solution I've seen for this challenge.

alisonpitt
11 - Bolide

My heart leapt out of my chest when I ran my first try of part 2 without looking how big the numbers were 😱 But handling the ranges of numbers ended up being a really interesting exercise. I feel like I probably could have used a macro for this, but with the number of steps, I went with brute-force.

Spoiler
5-1-ap.png5-2-ap.png
Qiu
21 - Polaris
21 - Polaris

At first I believed brutal force and finally getting the result as below. It was an epic failure.
Then moved to the Range comparing approach, with some hints from here, I got the answer and I decided to move on even I can not explain the logic in my flow.

Interesting thing is that I am still getting the incorrect answer when I use my input with the most of workflows uploaded here. 😁
So I guess its just something we can forget and leave behind and continue our life, continue to be tortured by Day 7 or Day xx. 😅 (Day 6, you are nice), continue to hope to retire to beach one day. @mceleavey  
giphy

 

Spoiler
Day5.PNGDay5-1.PNG 

 

kelsey_kincaid
12 - Quasar
12 - Quasar

I was on the cusp of solving this one for... many many hours. @AncientPandaman 's workflow looked most similar to my approach, so I ended up having to open that up to help me troubleshoot why I was getting the right answer on the sample data but not my prod data. It was super helpful - even though I was getting the right answer on the sample data, my approach was wrong,  and Pang_Hee_Choy's mapping table helped me identify those issues. Thank you for your work!

 

Spoiler
Part 1: I started with my favorite - a brute force generate rows approach. Shame on me for not first looking at my prod data! I had to re-tool to evaluate ranges instead. I did that by building an iterative macro that loops through each mapping table to find the matches.

Part 2: Beat my head against a wall for a long time on this. I didn't read the problem closely enough and wasn't subtracting 1 from the range in a number of calculations. I also had to tweak the way I was handling matches within partial ranges. Since locations without any mapping to previous values was my final output, I had a hard time tracing my work for troubleshooting. Lesson learned there too I think. I may need another night of sleep before I can fully explain how this works. 

Workflow:
D5.png
Part 1 Macro:
D5P1.png

Part 2 Macro:
D5P2.png
StevenP
8 - Asteroid

While going the route of brute force may have gotten me to the answer faster I refused to give in and kept banging my head to get this to run efficiently. Ultimately I succeeded and got my overall run time down to 1.1 seconds.

image.png

giphy

 

Spoiler
For Part 2 I reverse-engineered the location back into the seed based on the given ranges:
image.png

 

 

SuguruYoshinaga
9 - Comet

Part 2 was very difficult.

Spoiler
WF

image.png

Macro for part 1
 

image.png

Macro for part 2

image.png

leonhekkert
8 - Asteroid

Actually quite proud that I got the solution to part 2! Did have to start all over though as my approach to part 1 was the brute force kind. 

 

Part two is done with a batch and iterative macro and takes less then 2 seconds!

 

Spoiler
Day5.pngDay5Batch.png
Day5Iterative1.pngDay5Iterative2.png
lwolfie
11 - Bolide

I ran into the same trap as everyone.  My is definitely Ugly and I went the range route.

Laurap1228
11 - Bolide
Spoiler
I built two Macros for this one.
AOC5.PNG
Labels