We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 93db477 commit 4a4d15bCopy full SHA for 4a4d15b
03_triangles.rb
@@ -6,7 +6,5 @@ def tri?(a, b, c)
6
7
puts input.count { |x| tri?(*x.sort) }
8
puts input.each_slice(3).sum { |rows|
9
- [0, 1, 2].count { |col|
10
- tri?(*rows.map { |r| r[col] }.sort)
11
- }
+ rows.transpose.count { |x| tri?(*x.sort) }
12
}
0 commit comments