[2024][ruby][10.x] refactored to bring part one back
change wlryrrxmqswupzxlounuyropzpupntzl
commit 84010a700235c3efad1587b026dfe9305cc8f99c
author Alpha Chen <alpha@kejadlen.dev>
date
parent xknnuqwm
diff --git a/2024/ruby/day_10.rb b/2024/ruby/day_10.rb
index a096c76..25c2d9a 100644
--- a/2024/ruby/day_10.rb
+++ b/2024/ruby/day_10.rb
@@ -26,10 +26,14 @@ def trails(map, head)
   end
 
   finished
-    .select { _1.length > 2 && map.fetch(_1.last) == 9 }
+    .select { map.fetch(_1.last) == 9 }
     .uniq
 end
 
+# part one
+pp trailheads.sum { trails(map, _1).map(&:last).uniq.length }
+
+# part two
 pp trailheads.sum { trails(map, _1).length }
 
 __END__