We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
0 parents commit 55791aeCopy full SHA for 55791ae
01/a.rb
@@ -0,0 +1,15 @@
1
+max = 0
2
+sum = 0
3
+
4
+File
5
+ .readlines("01/input.txt")
6
+ .each do |line|
7
+ if line.strip == ""
8
+ max = [max, sum].max
9
+ sum = 0
10
+ else
11
+ sum += line.to_i
12
+ end
13
14
15
+p max
01/b.rb
@@ -0,0 +1,16 @@
+top = [0, 0, 0]
+ top << sum
+ top = top.sort[1..3]
16
+p top.sum
01/input.txt
0 commit comments