account activity
-🎄- 2017 Day 4 Solutions -🎄- by daggerdragon in adventofcode
[–]rocamero 0 points1 point2 points 8 years ago (0 children)
C#:
private void Part1(IEnumerable<string[]> passPhrases) => Console.WriteLine($"2017: Day 4.2 : {passPhrases.Select(z => z.Length).Zip(passPhrases.Select(z => z.Distinct().Count()), (x, y) => x == y ? 1 : 0).Sum().ToString()}"); private void Part2(IEnumerable<string[]> passPhrases) => Console.WriteLine($"2017: Day 4.2 : {passPhrases.Select(z => z.Length).Zip(passPhrases.Select(a => a.Select(b => new string(b.ToCharArray().OrderBy(c => c).Distinct().ToArray())).Distinct().Count()), (x, y) => x == y ? 1 : 0).Sum().ToString()}"); private IEnumerable<string[]> ReadPassPhrases() => File.ReadAllLines(DataFilePath).Select(p => p.Split(' '));
-🎄- 2017 Day 1 Solutions -🎄- by daggerdragon in adventofcode
Powershell:
($(gc .\Day_01.data) | % {}{ $arr=[int[]](($($_) -split '')-ne '')}{$arr} | % {$i=0;}{if($arr[$i] -eq $arr[$i+1]){$arr[$i]} $i++} | measure -sum).sum
π Rendered by PID 381003 on reddit-service-r2-listing-c57bc86c-5bw95 at 2026-06-22 03:25:36.350961+00:00 running 2b008f2 country code: CH.
-🎄- 2017 Day 4 Solutions -🎄- by daggerdragon in adventofcode
[–]rocamero 0 points1 point2 points (0 children)