Day 11: Reactor
Megathread guidelines
- Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
- You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL
FAQ
- What is this?: Here is a post with a large amount of details: https://programming.dev/post/6637268
- Where do I participate?: https://adventofcode.com/
- Is there a leaderboard for the community?: We have a programming.dev leaderboard with the info on how to join in this post: https://programming.dev/post/6631465


Rust
After the struggles of yesterday, nice to have an easy one. Still havent solved yesterdays pt2, struggling to understand z3 + rust.
Hope everyone else isnt too demoralised by the last 2 days!
spoiler
fn count_paths2( paths: &HashMap<&str, Vec<&str>>, seen: &mut HashMap<String, usize>, node: &str, dest: &str, ) -> usize { if let Some(c) = seen.get(node) { return *c; } if node == dest { seen.insert(node.to_string(), 1); return 1; } let Some(next) = paths.get(node) else { return 0; }; let mut total_paths = 0; for node in next { total_paths += count_paths2(paths, seen, node, dest) } seen.insert(node.to_string(), total_paths); total_paths } #[test] fn test_y2025_day11_part2() { let input = include_str!("../../input/2025/day_11.txt"); let mut paths: HashMap<&str, Vec<&str>> = HashMap::new(); input.lines().for_each(|line| { let (source, dests) = line.split_once(":").unwrap(); let dests = dests.split(" ").collect::<Vec<&str>>(); paths.insert(source, dests); }); // srv -> fft -> dac -> out let mut total1 = 1; { let mut seen = HashMap::new(); total1 *= count_paths2(&paths, &mut seen, "svr", "fft"); } { let mut seen = HashMap::new(); total1 *= count_paths2(&paths, &mut seen, "fft", "dac"); } { let mut seen = HashMap::new(); total1 *= count_paths2(&paths, &mut seen, "dac", "out"); } // srv -> dac -> fft -> out let mut total2 = 1; { let mut seen = HashMap::new(); total2 *= count_paths2(&paths, &mut seen, "svr", "dac"); } { let mut seen = HashMap::new(); total2 *= count_paths2(&paths, &mut seen, "dac", "fft"); } { let mut seen = HashMap::new(); total2 *= count_paths2(&paths, &mut seen, "fft", "out"); } println!("total: {}", total1 + total2); assert_eq!(total1 + total2, 509312913844956); }Good luck! If anything, yesterday’s problem is motivating (if not challenging) because I’m trying to use it to learn the simplex algorithm (off mediocre online tutorials—doubly so considering I think the problem needs dual simplex [pun intended]). I’ve spent far more time with pencil and paper trying to understand the algorithm than actually try writing code for it.
Yeah, ill have to bust out the pen and paper as well. Good learning excercise though :) Edit: If you find any good resources, please share :)