public override void PartOne() { Code = InputLine.Ints().ToArray(); for (var i = 0; i < 100; i++) { Fft(); } WriteLn(Code.Take(8).Str()); }
public override void PartTwo() { InputLine.Ints() .Batch(Height * Width) .Aggregate((a, b) => a.Zip(b) .Select(tuple => tuple.First is 0 or 1 ? tuple.First : tuple.Second)) .Batch(Width) .Select(ints => string.Concat(ints.QuickMap(1, '#', ' '))) .ForEach(WriteLn); }
public override void PartOne() { var layer = InputLine.Ints() .Batch(Height * Width) .Select(ints => ints.Frequencies().ToDictionary()) .OrderBy(layer => layer[0]) .First(); WriteLn(layer[1] * layer[2]); }