Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!
alteryx Community

# General Discussions

Discuss any topics that are not product-specific here.

## Advent of Code 2023 Day 1 (BaseA Style)

Alteryx Community Team

81 REPLIES 81
Alteryx

Well now that was just a dirty trick to pull with part 2. But we're off!! #WestCoastBestCoast  😁

Spoiler

Part 1 was pretty straightforward - big fan of the Data Cleanse for making that one super easy to ditch a bunch of letters.

Part 2 seemed like it would be a breeze... until I was wrong with my first answer, and looked at the first few lines of my puzzle code code, and saw "oneight". NOT COOL. So I had to add some extra lookup values to combine numbers that start/end with the same letter (oneight, eightwo, etc.) Feels a bit brute force in the end (you could get in a real pickle if you started going down the infinite loop of oneightwoneightwoneightwo... where does it end?!?) but luckily the elves weren't that mean. Today.

Cheers to the most wonderful time of the year!!

Cheers!
NJ
Sr. Manager, Product Management, Designer
Alteryx
17 - Castor

My solution.

Spoiler
It was a terrible trick from the first question. If I couldn't catch the "oneight", I think I will wander forever.

@NicoleJ You are too fast!!! And your solution is very cool! I didn't think of using Data Cleanse.

This year is not bad start(Last year I forgot the start time.I started one hour lator).

12 - Quasar
Spoiler

Part 1 gave me a false sense of confidence. Used REGEX Replace to remove any non-digit characters and then concatenate the first and last digits.

Part 2 tripped me up a bit - had a hard time figuring out the best way to isolate the very last word/digit in the string since phrases like "oneight" could hypothetically match either a 1 or an 8, but which it needed to match depended on where it was in the string. I like the brute force @NicoleJ - sometimes that's the fastest way! I ended up using the Regex tool inelegantly to parse the first and last value to handle for this, but it took me quite awhile to figure out.

first value regex pattern: "([1-9]|(?:one|two|three|four|five|six|seven|eight|nine)).*"
last value regex pattern: ".*([1-9]|(?:one|two|three|four|five|six|seven|eight|nine))"

Great warm up overall!

12 - Quasar

I joined.

Spoiler
Regex is so useful.
first digit=REGEX_Replace([For example:], ".*?(\d|one|two|three|four|five|six|seven|eight|nine).*","\$1")
last digit=REGEX_Replace([For example:], ".*(\d|one|two|three|four|five|six|seven|eight|nine).*?\$","\$1")

15 - Aurora

Everybody so fast!

Spoiler
Part2 was a bit tricky one.
13 - Pulsar

Interesting!

Spoiler

20 - Arcturus

Cost me quite sometime, but managed to solve it.

Spoiler
8 - Asteroid
Spoiler
11 - Bolide

Didn't want to hard-code the overlapping number string replacements.

Spoiler

Labels