From 36bb28af87e81a9b3cab1abd79d11106cd610f6c Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 2 Dec 2020 00:36:24 -0500 Subject: update gitignore and run resharper cleanup --- Day6.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Day6.cs') diff --git a/Day6.cs b/Day6.cs index 50dd605..d92b402 100644 --- a/Day6.cs +++ b/Day6.cs @@ -5,14 +5,15 @@ namespace aoc2019 { internal sealed class Day6 : Day { - public override int DayNumber => 6; - private readonly Dictionary input; + public Day6() { input = Input.ToDictionary(i => i.Split(')')[1], i => i.Split(')')[0]); } + public override int DayNumber => 6; + private List GetParents(string obj) { var res = new List(); @@ -29,11 +30,11 @@ namespace aoc2019 public override string Part2() { - List you = GetParents("YOU"); - List san = GetParents("SAN"); - int common = 1; - for (; you[^common] == san[^common]; common++); + var you = GetParents("YOU"); + var san = GetParents("SAN"); + var common = 1; + for (; you[^common] == san[^common]; common++) ; return $"{you.Count + san.Count - common * 2}"; } } -} +} \ No newline at end of file -- cgit 1.4.1