Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2023 Day 1 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

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

81 REPLIES 81
NicoleJ
Alteryx
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.

 

Day1_NJ.png

Cheers to the most wonderful time of the year!!

 

Cheers!
NJ
Sr. Manager, Product Management, Designer
Alteryx
AkimasaKajitani
17 - Castor
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.

 
スクリーンショット 2023-12-01 145139.png


@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).

kelsey_kincaid
12 - Quasar
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!

 
 
 

AOCDay1.png

Tokimatsu
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")
スクリーンショット 2023-12-01 151155.png

gawa
16 - Nebula
16 - Nebula

Everybody so fast!

Spoiler
Part2 was a bit tricky one.  
image.png
DaisukeTsuchiya
14 - Magnetar

Interesting!

Spoiler
スクリーンショット 2023-12-01 153836.png

Qiu
21 - Polaris
21 - Polaris

Cost me quite sometime, but managed to solve it.

Spoiler
AOC2023-Day1.png
nikhilnijhar
8 - Asteroid
Spoiler
Screenshot 2023-12-01 151526.png
joshbennett
11 - Bolide
11 - Bolide

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

Spoiler
2023-12-01_01-23-10.png

Labels
Top Solution Authors