For part 1 I built a solution that created all permutations of the gear string, then used regex to find the ones with a match. However, this didn't scale to part 2, so I devised a new approach using recursion and the functools.cache function decorator. This code seems to work as expected for all the samples, but it's returning the wrong answer for part 2. Could someone take a peek and point me in the right direction? Here is the code: https://github.com/jturinetti/AdventOfCode_2023/blob/main/12/problem.py
Any help is appreciated!