Пример #1
0
        protected override int ComputeResultLogic(IEnumerable <Day5InputModel> input)
        {
            var seatIds = Day5Helper.ComputeSeatIds(input).ToList();

            seatIds.Sort();

            var specialSeatId = 0;

            for (var index = 1; index < seatIds.Count - 1; index += 2)
            {
                if (seatIds[index] != seatIds[index - 1] + 1 ||
                    seatIds[index] != seatIds[index + 1] - 1)
                {
                    specialSeatId = seatIds[index];
                }
            }

            return(specialSeatId + 1);
        }
Пример #2
0
        protected override int ComputeResultLogic(IEnumerable <Day5InputModel> input)
        {
            var seatIds = Day5Helper.ComputeSeatIds(input);

            return(seatIds.Max());
        }