Beispiel #1
0
        public string SolvePart2()
        {
            var repairDroidControlSystem = new RepairDroidControlSystem(Input);

            repairDroidControlSystem.Explore();

            int longestPath = repairDroidControlSystem.FindPath(repairDroidControlSystem.Destination)
                              .Max(x => x.Distance);

            return($"Part 2: {longestPath}");
        }
Beispiel #2
0
        public string SolvePart1()
        {
            var repairDroidControlSystem = new RepairDroidControlSystem(Input);

            repairDroidControlSystem.Explore();

            int shortestPath = repairDroidControlSystem.FindPath(RepairDroidControlSystem.Origin)
                               .SingleOrDefault(
                n => n.Location == repairDroidControlSystem.Destination)
                               ?.Distance ?? 0;

            return($"Part 1: {shortestPath}");
        }