public void Puzzle_21A() { var ai = new AllergenIdentifier { Sets = PuzzleInput.Select(x => new Set(x)).ToList() }; ai.Analyze(); Assert.Equal(2317, ai.CountAllergenFreeIngredientsOccurrences()); }
public void Puzzle_21B() { var ai = new AllergenIdentifier { Sets = PuzzleInput.Select(x => new Set(x)).ToList() }; ai.Analyze(); var dangerousIngredients = ai.Sets .SelectMany(x => x.DangerousIngredients) .Distinct() .OrderBy(x => x.Value) .Aggregate("", (c, n) => $"{c},{n.Key}")[1..]; Assert.Equal("kbdgs,sqvv,slkfgq,vgnj,brdd,tpd,csfmb,lrnz", dangerousIngredients); }