alteryx Community

# General Discussions

Discuss a wide range of topics! Questions about the Alteryx Platform should be directed to the appropriate Product discussion forum.

## Advent of Code 2021 Day 7 (BaseA Style)

16 - Nebula

20 REPLIES 20
7 - Meteor

A nice break from all the iterations

Spoiler
I think I've used the generate row tool more times this contest then I've ever used it before.
Went with a brute force approach. Used generate rows to create every possible position and then calculated the fuel cost. Sorted for the min fuel cost per possible position.

12 - Quasar

More generate rows!

Spoiler
I only considered positions in the 25%-75% percentiles to save processing speed. I let the batch macro calculate the fuel used for each position and output the result.

14 - Magnetar

Nicole's pro tip for today: Pay attention to the field length in your initial data input. 254 characters is not enough, and you will waste 10 minutes questioning everything you ever knew about Alteryx before realizing this. #AskMeHowIKnowThis

Spoiler
I don't often find reasons to use the Running Total tool, but by golly, Part 2 of this challenge was built for it. Gold medal for you, Running Total!!

Cheers!

NJ

11 - Bolide

Nice and simple one today. Generate Rows has been da real MVP.

Spoiler

13 - Pulsar
Spoiler
Oh why is there not a factorial function in the formula tool?
I initially created the generate rows to get the factorial after my calculation of fuel = abs ( start position - end position ), however this was too slow as it just explodes the data unnecessarily. So moved it earlier in the workflow and then joined on only the required values.

Also got to use my input macro! But I didn't wake at 5am so lost out on the speed points!

edit: I’ve just realised we are not solving a factorial in part two as n! = n*(n-1)! And we are adding consecutive values not multiplying. Well at least I was doing the right thing in my solution just calling it the wrong thing!

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
13 - Pulsar

Spoiler
Dang! I like how @NicoleJohnson used running total, as you've already generated all the numbers i.e. you've calculated the abs(position - new position) via the generate rows so you just need to apply the running total to get the equivalent of the factorial.

Plus how @bflick just evaluated it as abs(position - new position) * (abs(position - new position)+1)/2

Edit: there’s an even better way, part 1 is just the median of all the starting positions and in general part 2 can be evaluated to the mean (+/-1) 😲 https://www.reddit.com/r/adventofcode/comments/rars4g/2021_day_7_why_do_these_values_work_spoilers/?...

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
11 - Bolide

I need to read the directions more carefully - I put in the position instead of the fuel amount and couldn't figure out my "mistake" for 30 minutes 😩In hindsight I probably didn't need the batch macro.

Spoiler

15 - Aurora

At Day07, I use the Generate Row tool to make all positions.

Spoiler
At star2, it takes too long time to calculate Factorial. So I use the batch macro to do it and it takes 20 minutes to calculate it.

For star2 macro:

GitHub