コード例 #1
0
        protected override long ComputeResultLogic(Graph <long> input)
        {
            var maxValue   = input.AllNodes.Values.Select(n => n.Value).Max();
            var lastNode   = input.AllNodes.Single(n => n.Value.Value == maxValue);
            var totalPaths = new Dictionary <long, long>();
            var nodeValues = input.AllNodes.Select(n => n.Value.Value).ToList();

            nodeValues.Sort();
            nodeValues.Insert(0, 0);
            nodeValues.Add(nodeValues.Last() + 3);

            var countPaths = Day10Helper.ComputeTotalPaths(nodeValues.ToArray(),
                                                           totalPaths);

            return(countPaths);
        }
コード例 #2
0
        protected override long ComputeResultLogic(Graph <long> input)
        {
            var differencesResult = Day10Helper.ComputeDifferences(input);

            return(differencesResult);
        }