public void Puzzle_1A() { var input = PuzzleInputs.Puzzle1; var finder = new FactorFinder { Candidates = input }; var result = finder.FindTwoCandidatesThatSumTo(2020).ToArray(); Assert.Equal(2020, result[0] + result[1]); Assert.Equal(1, result[0] * result[1]); }
public void Should_find_candidates_that_sum_to_given_target() { var finder = new FactorFinder { Candidates = new[] { 1721, 979, 366, 299, 675, 1456 } }; var result = finder.FindTwoCandidatesThatSumTo(2020).ToList(); Assert.Contains(1721, result); Assert.Contains(299, result); }