Beispiel #1
0
        public async Task <string> Run()
        {
            string resourceName = "AdventOfCode19App.Day8.Dataset.txt";
            var    strings      = await DataHelper.GetStringTestDataAsync(resourceName);

            IEnumerable <int> integers = IntegerHelper.StringToIntIEnumerable(strings);

            int[,] array = ToMultiDimensionalArray(integers.ToArray(), 25);
            (int min, IEnumerable <int> numbers)minGroup = GetLayerWithMinNumber(array, 0, 6, 25);

            var countOneNumbers = minGroup.numbers.Where(x => x == 1).Count();
            var countTwoNumbers = minGroup.numbers.Where(x => x == 2).Count();

            StringBuilder builder = new StringBuilder();

            builder.AppendLine($"Part 1: {Convert.ToString(countOneNumbers * countTwoNumbers)}");

            return(builder.ToString());
        }