this post was submitted on 04 Dec 2023
6 points (100.0% liked)

Advent of Code

264 readers
1 users here now

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

https://adventofcode.com

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 11 months ago

Recursion probably made things a little trickier for you (but is totally possible). The special piece to notice in part 2 is that you are only forward creating cards and (most importantly) there are no decisions to optimize. Each card alway produces the same result.

This problem reminded me of the lantern fish problem. The trick with this one was not tracking individual fish, instead you only need the number of each generation you have (and in today's puzzle we just need to track how many of each card you have)