Skip to content

Commit

Permalink
Day 23 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaKateryna committed Dec 23, 2024
1 parent 89a19ff commit a10c3a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions AdventOfCode/Day23.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public override ValueTask<string> Solve_1()
{
string[] lines = File.ReadAllLines(InputFilePath);

HashSet<(string, string, string)> groups = new HashSet<(string, string, string)>();
HashSet<string> groups = new HashSet<string>();
Dictionary<string, List<string>> dictionary = ToDictionary(lines);

foreach (var kv in dictionary)
Expand All @@ -24,13 +24,13 @@ public override ValueTask<string> Solve_1()
{
var group = new List<string> { computer1, kv.Value[i], kv.Value[j] };
group = group.OrderBy(x => x).ToList();
groups.Add((group[0], group[1], group[2]));
groups.Add($"{group[0]},{group[1]},{group[2]}");
}
}
}
}

int res = groups.Count(g => g.Item1.StartsWith("t") || g.Item2.StartsWith("t") || g.Item3.StartsWith("t"));
int res = groups.Count(g => g.Split(",").Any(x => x.StartsWith("t")));

return new (res.ToString());
}
Expand Down

0 comments on commit a10c3a1

Please sign in to comment.