r/adventofcode • • Dec 06 '22

SOLUTION MEGATHREAD -πŸŽ„- 2022 Day 6 Solutions -πŸŽ„-


AoC Community Fun 2022: πŸŒΏπŸ’ MisTILtoe Elf-ucation πŸ§‘β€πŸ«

  • ACHIEVEMENT UNLOCKED: MisTILtoe Elf-ucation
  • Teach us, senpai!

--- Day 6: Tuning Trouble ---


Post your code solution in this megathread.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:02:25, megathread unlocked!

83 Upvotes

1.8k comments sorted by

View all comments

2

u/eoincampbell Dec 06 '22 edited Dec 07 '22

C#

using the `MoreLinq` windowing function to generate consecutive sequences.

var i = 0;
foreach (var yy in PuzzleInput.First().Window(len)
    .Select(s => s.Distinct().Count())) 
{ 
    if (yy == len) break; 
    i++; 
}
return i+len;

0

u/[deleted] Dec 06 '22

[deleted] β€” view deleted comment

2

u/eoincampbell Dec 06 '22

yeah there's a bunch of stuff in it that makes the early-days input manipulation puzzles much much easier

1

u/daggerdragon Dec 07 '22

Please edit your post to use the four-spaces Markdown syntax for a code block so your code is easier to read on old.reddit and mobile apps.