From bb6619aaa4f023618bd0c22783eae8d36929190e Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Mon, 23 Dec 2024 06:59:42 +0100 Subject: [PATCH] Improve Ruby solution for 2024 day 23 --- src/2024/23/solve.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/2024/23/solve.rb b/src/2024/23/solve.rb index 5f16278..a8821b3 100755 --- a/src/2024/23/solve.rb +++ b/src/2024/23/solve.rb @@ -13,8 +13,7 @@ part1 = Set.new graph.keys.select { _1.start_with?('t') }.each do |start| adj = graph[start].to_a adj.combination(2) do |a, b| - next unless graph[a].include?(start) && graph[b].include?(start) && graph[a].include?(b) - part1 << [start, a, b].sort + part1 << [start, a, b].sort if graph[a].include?(b) end end -- 2.54.0