예제 #1
0
        public override async Task Part2()
        {
            var fromNumber   = Convert.ToInt32(new string(PuzzleInput.Take(6).ToArray()));
            var toNumber     = Convert.ToInt32(new string(PuzzleInput.Skip(7).Take(6).ToArray()));
            var numberRange  = Enumerable.Range(fromNumber, toNumber - fromNumber);
            var count        = 0;
            var validNumbers = new List <int>();

            foreach (var number in numberRange)
            {
                if (CheckNumberPart2(number))
                {
                    validNumbers.Add(number);
                }
            }
            ResultPart2 = validNumbers.Count.ToString();;
        }