Пример #1
0
        public override object SolvePart1(string input)
        {
            var timeSheet = TimeSheet.CalculateTimesheet(input);

            var guardsTotalSleepTimes = from guard in timeSheet.AllGuardIds()
                                        select(guard, sleepTime: timeSheet.GuardTotalSleepMinutes(guard));

            var sleepiestGuard = guardsTotalSleepTimes.OrderByDescending(x => x.sleepTime)
                                 .First()
                                 .guard;

            var sleepMatrix = timeSheet.DaysAsleepPerMinute(sleepiestGuard);

            var sleepiestMinute = sleepMatrix.OrderByDescending(x => x.asleepCount)
                                  .First();

            return(sleepiestGuard * sleepiestMinute.minute);
        }
Пример #2
0
        public Day1804_TimesheetTests()
        {
            var observations = new Day1804Solution().GetPart1SampleInputs().First();

            TimeSheet = TimeSheet.CalculateTimesheet(observations);
        }