From 76bd7d9c54712207d5258f4ce3bccdb03818a8dc Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 7 Dec 2020 16:14:03 +0100 Subject: [PATCH] 2020: day07: add note --- aoc2020/src/day07.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aoc2020/src/day07.rs b/aoc2020/src/day07.rs index a2e9a8c..37fd9d4 100644 --- a/aoc2020/src/day07.rs +++ b/aoc2020/src/day07.rs @@ -30,6 +30,9 @@ fn part1(input: &str) -> aoc::Result { let mut memoized = HashMap::new(); + // NOTE: part 1 can also be solved efficiently by using a graph where a bag has its parents as + // neighbours, and then by computing the size of the sub graph accessible from 'shiny + // gold' Ok(bag_rules .iter() .filter(|bag| bag.can_contain("shiny gold", &bag_rules_map, &mut memoized))