protected override int ComputeResultLogic(Graph <string> input) { var permittedBags = new List <string>(); var shinyGoldNode = input.AllNodes.SingleOrDefault(n => n.Key == ShinyGoldBagName); Day7Helper.FindAncestors(shinyGoldNode.Value, permittedBags); return(permittedBags.Count); }
protected override long ComputeResultLogic(Graph <string> input) { var permittedBags = new List <string>(); var shinyGoldNode = input.AllNodes.SingleOrDefault(n => n.Key == ShinyGoldBagName); Day7Helper.FindAncestors(shinyGoldNode.Value, permittedBags); var total = Day7Helper.ComputeTotalNumberOfChildrenBags(shinyGoldNode.Value, 1); return(total); }