25 lines
701 B
C#
25 lines
701 B
C#
namespace AdventOfCodeLibrary._2022
|
|
{
|
|
using AdventOfCodeLibrary.Shared;
|
|
|
|
public class Day01Part2 : Answerable
|
|
{
|
|
public override int Year { get; set; } = 2022;
|
|
public override int Day { get; set; } = 1;
|
|
public override int Part { get; set; } = 2;
|
|
|
|
public override string GetAnswer(byte[] data)
|
|
{
|
|
return GetAsString(data).TrimEnd()
|
|
.TrimEnd()
|
|
.Split(NewLine + NewLine)
|
|
.Select(s => s.Split(NewLine)
|
|
.Sum(Convert.ToInt32))
|
|
.OrderByDescending(v => v)
|
|
.Take(3)
|
|
.Sum()
|
|
.ToString();
|
|
}
|
|
}
|
|
}
|