Optimizing a c# solution (algorithm)
Hi, our professor gave us this problem for uni https://observablehq.com/@mpcowan/day-6-universal-orbit-map as a challenge (not graded), and asked us if we can optimize the solution in any way. Do you guys have any opinion on how to do it? I have so far thought about caching the results of recursion but on further analysis, I realized that the recursion call never really repeats, so caching doesn't make sense. I am also reading up more about dynamic programming and matrix exponentiation but I am not sure how else I can optimize this. Do you guys have any hints or any idea?
Observable
You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of the local orbits (your puzzle input). Except for the universal Center of Mass (COM), every obj...