Calling all Alteryx customers: Refer your colleague to try Alteryx and receive a $50 gift card. Sign up now!

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2024 Day 4 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 4 of the Advent of Code - https://adventofcode.com/2024/day/4

60 REPLIES 60
binuacs
21 - Polaris
Spoiler
image.png
matthewblandford
8 - Asteroid

Surprisingly straightforward today - a fun little puzzle this time around.

realdaniel1989
8 - Asteroid
Spoiler
AlteryxGui_vntrF9huSA.png
Malvim
11 - Bolide

X Y cartesian no macros

 

part 1

 

Spoiler
Day4_2024_part1.PNG

part 2

 

Spoiler
Day4_2024_part2.PNG

 

Marcus Alvim

SeanAdams
17 - Castor
17 - Castor

I liked this one - took a little time to carve out a spot to work on it, but it was enjoyable (a little geometric thinking)

Spoiler
Approach:
create a rowID; a column ID; a diagnal 1 & 2 ID (for the two diagonal directions).   this way you can group them into strings
- To create the diags - it's worth knowing that on the one diag, x+y =c; and on the other x-y = c
Then you just take these groups and look for the relevant strings

For part 2 - if you know which letter in the string is the A, you can do a simple join to find X shapes - and then just count.

image.png


Python solution to follow.

Code is stored here: SeanAdams10/AdventOfCodePython: Advent of code challenges in Python - across multiple years

 

SeanAdams
17 - Castor
17 - Castor

:-) it's great to see the progression of thinking as you refined this @CoG 

SeanAdams
17 - Castor
17 - Castor

Agree with you @NicoleJ - the record ID with grouping really is a great addition - I expect the tile tool to get very very lonely now.

Tokimatsu
12 - Quasar

Very slow. I may brash up this.

Spoiler
スクリーンショット 2024-12-05 204619.png

 

Bobbyt23
12 - Quasar

Finally managed to get through Day 4!

 

Spoiler
image.png
IgorL
6 - Meteoroid

Took me way too long to realize I was counting diagonals in only one direction ðŸ˜…

 

Spoiler
Record ID and Tile can be used to get the coordinates for each letter, simple formula to group letters into diagonals. Concatenate base on each coordinate to get all possible strings and parse for results.

For part 2, parse each set of diagonals for MAS/SAM then join based on coordinates to find overlaps.

image.png

Labels
Top Solution Authors