advent_of_ruby 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/bin/arb +1 -1
  3. data/data/solutions/reddit/ruby/2015/02.yml +5 -5
  4. data/data/solutions/reddit/ruby/2015/03.yml +6 -6
  5. data/data/solutions/reddit/ruby/2015/04.yml +7 -7
  6. data/data/solutions/reddit/ruby/2015/05.yml +6 -6
  7. data/data/solutions/reddit/ruby/2015/06.yml +14 -14
  8. data/data/solutions/reddit/ruby/2015/07.yml +15 -15
  9. data/data/solutions/reddit/ruby/2015/08.yml +6 -6
  10. data/data/solutions/reddit/ruby/2015/09.yml +11 -11
  11. data/data/solutions/reddit/ruby/2015/10.yml +18 -18
  12. data/data/solutions/reddit/ruby/2015/11.yml +19 -19
  13. data/data/solutions/reddit/ruby/2015/12.yml +10 -10
  14. data/data/solutions/reddit/ruby/2015/13.yml +9 -9
  15. data/data/solutions/reddit/ruby/2015/14.yml +11 -11
  16. data/data/solutions/reddit/ruby/2015/15.yml +9 -9
  17. data/data/solutions/reddit/ruby/2015/16.yml +7 -7
  18. data/data/solutions/reddit/ruby/2015/17.yml +10 -10
  19. data/data/solutions/reddit/ruby/2015/18.yml +4 -4
  20. data/data/solutions/reddit/ruby/2015/19.yml +1 -1
  21. data/data/solutions/reddit/ruby/2015/20.yml +2 -2
  22. data/data/solutions/reddit/ruby/2015/21.yml +4 -4
  23. data/data/solutions/reddit/ruby/2015/22.yml +5 -5
  24. data/data/solutions/reddit/ruby/2015/23.yml +3 -3
  25. data/data/solutions/reddit/ruby/2015/24.yml +11 -11
  26. data/data/solutions/reddit/ruby/2015/25.yml +5 -5
  27. data/data/solutions/reddit/ruby/2016/01.yml +5 -5
  28. data/data/solutions/reddit/ruby/2016/02.yml +3 -3
  29. data/data/solutions/reddit/ruby/2016/03.yml +1 -1
  30. data/data/solutions/reddit/ruby/2016/04.yml +4 -4
  31. data/data/solutions/reddit/ruby/2016/05.yml +3 -3
  32. data/data/solutions/reddit/ruby/2016/06.yml +4 -4
  33. data/data/solutions/reddit/ruby/2016/07.yml +3 -3
  34. data/data/solutions/reddit/ruby/2016/08.yml +6 -6
  35. data/data/solutions/reddit/ruby/2016/09.yml +1 -1
  36. data/data/solutions/reddit/ruby/2016/10.yml +3 -3
  37. data/data/solutions/reddit/ruby/2016/11.yml +1 -1
  38. data/data/solutions/reddit/ruby/2016/12.yml +3 -3
  39. data/data/solutions/reddit/ruby/2016/14.yml +4 -4
  40. data/data/solutions/reddit/ruby/2016/15.yml +11 -11
  41. data/data/solutions/reddit/ruby/2016/16.yml +1 -1
  42. data/data/solutions/reddit/ruby/2016/17.yml +3 -3
  43. data/data/solutions/reddit/ruby/2016/18.yml +3 -3
  44. data/data/solutions/reddit/ruby/2016/20.yml +2 -2
  45. data/data/solutions/reddit/ruby/2016/21.yml +7 -7
  46. data/data/solutions/reddit/ruby/2016/22.yml +10 -10
  47. data/data/solutions/reddit/ruby/2017/01.yml +7 -7
  48. data/data/solutions/reddit/ruby/2017/02.yml +15 -15
  49. data/data/solutions/reddit/ruby/2017/03.yml +9 -9
  50. data/data/solutions/reddit/ruby/2017/04.yml +4 -4
  51. data/data/solutions/reddit/ruby/2017/05.yml +12 -12
  52. data/data/solutions/reddit/ruby/2017/06.yml +16 -16
  53. data/data/solutions/reddit/ruby/2017/07.yml +5 -5
  54. data/data/solutions/reddit/ruby/2017/08.yml +18 -18
  55. data/data/solutions/reddit/ruby/2017/09.yml +7 -7
  56. data/data/solutions/reddit/ruby/2017/10.yml +9 -9
  57. data/data/solutions/reddit/ruby/2017/11.yml +1 -1
  58. data/data/solutions/reddit/ruby/2017/12.yml +6 -6
  59. data/data/solutions/reddit/ruby/2017/13.yml +6 -6
  60. data/data/solutions/reddit/ruby/2017/14.yml +1 -1
  61. data/data/solutions/reddit/ruby/2017/15.yml +3 -3
  62. data/data/solutions/reddit/ruby/2017/16.yml +5 -5
  63. data/data/solutions/reddit/ruby/2017/17.yml +6 -6
  64. data/data/solutions/reddit/ruby/2017/18.yml +7 -7
  65. data/data/solutions/reddit/ruby/2017/19.yml +2 -2
  66. data/data/solutions/reddit/ruby/2017/20.yml +5 -5
  67. data/data/solutions/reddit/ruby/2017/21.yml +11 -11
  68. data/data/solutions/reddit/ruby/2017/22.yml +1 -1
  69. data/data/solutions/reddit/ruby/2017/23.yml +1 -1
  70. data/data/solutions/reddit/ruby/2017/25.yml +3 -3
  71. data/data/solutions/reddit/ruby/2018/01.yml +20 -20
  72. data/data/solutions/reddit/ruby/2018/02.yml +16 -16
  73. data/data/solutions/reddit/ruby/2018/03.yml +12 -12
  74. data/data/solutions/reddit/ruby/2018/04.yml +6 -6
  75. data/data/solutions/reddit/ruby/2018/05.yml +15 -15
  76. data/data/solutions/reddit/ruby/2018/06.yml +4 -4
  77. data/data/solutions/reddit/ruby/2018/07.yml +11 -11
  78. data/data/solutions/reddit/ruby/2018/08.yml +9 -9
  79. data/data/solutions/reddit/ruby/2018/09.yml +13 -13
  80. data/data/solutions/reddit/ruby/2018/10.yml +10 -10
  81. data/data/solutions/reddit/ruby/2018/11.yml +9 -9
  82. data/data/solutions/reddit/ruby/2018/12.yml +2 -2
  83. data/data/solutions/reddit/ruby/2018/13.yml +14 -14
  84. data/data/solutions/reddit/ruby/2018/14.yml +5 -5
  85. data/data/solutions/reddit/ruby/2018/15.yml +2 -2
  86. data/data/solutions/reddit/ruby/2018/16.yml +7 -7
  87. data/data/solutions/reddit/ruby/2018/17.yml +1 -1
  88. data/data/solutions/reddit/ruby/2018/18.yml +6 -6
  89. data/data/solutions/reddit/ruby/2018/19.yml +1 -1
  90. data/data/solutions/reddit/ruby/2018/20.yml +1 -1
  91. data/data/solutions/reddit/ruby/2018/21.yml +4 -4
  92. data/data/solutions/reddit/ruby/2018/22.yml +3 -3
  93. data/data/solutions/reddit/ruby/2018/23.yml +11 -11
  94. data/data/solutions/reddit/ruby/2018/24.yml +4 -4
  95. data/data/solutions/reddit/ruby/2018/25.yml +6 -6
  96. data/data/solutions/reddit/ruby/2019/01.yml +11 -11
  97. data/data/solutions/reddit/ruby/2019/02.yml +13 -13
  98. data/data/solutions/reddit/ruby/2019/03.yml +7 -7
  99. data/data/solutions/reddit/ruby/2019/04.yml +11 -11
  100. data/data/solutions/reddit/ruby/2019/05.yml +10 -10
  101. data/data/solutions/reddit/ruby/2019/06.yml +7 -7
  102. data/data/solutions/reddit/ruby/2019/07.yml +8 -8
  103. data/data/solutions/reddit/ruby/2019/08.yml +8 -8
  104. data/data/solutions/reddit/ruby/2019/09.yml +4 -4
  105. data/data/solutions/reddit/ruby/2019/10.yml +4 -4
  106. data/data/solutions/reddit/ruby/2019/11.yml +7 -7
  107. data/data/solutions/reddit/ruby/2019/12.yml +17 -17
  108. data/data/solutions/reddit/ruby/2019/13.yml +6 -6
  109. data/data/solutions/reddit/ruby/2019/14.yml +2 -2
  110. data/data/solutions/reddit/ruby/2019/15.yml +3 -3
  111. data/data/solutions/reddit/ruby/2019/16.yml +6 -6
  112. data/data/solutions/reddit/ruby/2019/17.yml +3 -3
  113. data/data/solutions/reddit/ruby/2019/18.yml +1 -1
  114. data/data/solutions/reddit/ruby/2019/20.yml +9 -9
  115. data/data/solutions/reddit/ruby/2019/21.yml +3 -3
  116. data/data/solutions/reddit/ruby/2019/22.yml +3 -3
  117. data/data/solutions/reddit/ruby/2019/23.yml +1 -1
  118. data/data/solutions/reddit/ruby/2019/25.yml +2 -2
  119. data/data/solutions/reddit/ruby/2020/01.yml +30 -30
  120. data/data/solutions/reddit/ruby/2020/02.yml +25 -25
  121. data/data/solutions/reddit/ruby/2020/03.yml +17 -17
  122. data/data/solutions/reddit/ruby/2020/04.yml +26 -26
  123. data/data/solutions/reddit/ruby/2020/05.yml +35 -35
  124. data/data/solutions/reddit/ruby/2020/06.yml +40 -40
  125. data/data/solutions/reddit/ruby/2020/07.yml +16 -16
  126. data/data/solutions/reddit/ruby/2020/08.yml +13 -13
  127. data/data/solutions/reddit/ruby/2020/09.yml +21 -21
  128. data/data/solutions/reddit/ruby/2020/10.yml +29 -29
  129. data/data/solutions/reddit/ruby/2020/11.yml +8 -8
  130. data/data/solutions/reddit/ruby/2020/12.yml +22 -22
  131. data/data/solutions/reddit/ruby/2020/13.yml +15 -15
  132. data/data/solutions/reddit/ruby/2020/14.yml +11 -11
  133. data/data/solutions/reddit/ruby/2020/15.yml +9 -9
  134. data/data/solutions/reddit/ruby/2020/16.yml +13 -13
  135. data/data/solutions/reddit/ruby/2020/17.yml +11 -11
  136. data/data/solutions/reddit/ruby/2020/18.yml +19 -19
  137. data/data/solutions/reddit/ruby/2020/19.yml +18 -18
  138. data/data/solutions/reddit/ruby/2020/20.yml +4 -4
  139. data/data/solutions/reddit/ruby/2020/21.yml +4 -4
  140. data/data/solutions/reddit/ruby/2020/22.yml +8 -8
  141. data/data/solutions/reddit/ruby/2020/23.yml +4 -4
  142. data/data/solutions/reddit/ruby/2020/24.yml +6 -6
  143. data/data/solutions/reddit/ruby/2020/25.yml +6 -6
  144. data/data/solutions/reddit/ruby/2021/01.yml +74 -74
  145. data/data/solutions/reddit/ruby/2021/02.yml +45 -45
  146. data/data/solutions/reddit/ruby/2021/03.yml +43 -43
  147. data/data/solutions/reddit/ruby/2021/04.yml +23 -23
  148. data/data/solutions/reddit/ruby/2021/05.yml +16 -16
  149. data/data/solutions/reddit/ruby/2021/06.yml +35 -35
  150. data/data/solutions/reddit/ruby/2021/07.yml +26 -26
  151. data/data/solutions/reddit/ruby/2021/08.yml +15 -15
  152. data/data/solutions/reddit/ruby/2021/09.yml +11 -11
  153. data/data/solutions/reddit/ruby/2021/10.yml +9 -9
  154. data/data/solutions/reddit/ruby/2021/11.yml +12 -12
  155. data/data/solutions/reddit/ruby/2021/12.yml +8 -8
  156. data/data/solutions/reddit/ruby/2021/13.yml +13 -13
  157. data/data/solutions/reddit/ruby/2021/14.yml +10 -10
  158. data/data/solutions/reddit/ruby/2021/15.yml +10 -10
  159. data/data/solutions/reddit/ruby/2021/16.yml +8 -8
  160. data/data/solutions/reddit/ruby/2021/17.yml +6 -6
  161. data/data/solutions/reddit/ruby/2021/18.yml +5 -5
  162. data/data/solutions/reddit/ruby/2021/19.yml +3 -3
  163. data/data/solutions/reddit/ruby/2021/20.yml +5 -5
  164. data/data/solutions/reddit/ruby/2021/21.yml +5 -5
  165. data/data/solutions/reddit/ruby/2021/22.yml +4 -4
  166. data/data/solutions/reddit/ruby/2021/23.yml +7 -7
  167. data/data/solutions/reddit/ruby/2021/24.yml +8 -8
  168. data/data/solutions/reddit/ruby/2021/25.yml +4 -4
  169. data/data/solutions/reddit/ruby/2022/01.yml +29 -29
  170. data/data/solutions/reddit/ruby/2022/02.yml +21 -21
  171. data/data/solutions/reddit/ruby/2022/03.yml +35 -35
  172. data/data/solutions/reddit/ruby/2022/04.yml +42 -42
  173. data/data/solutions/reddit/ruby/2022/05.yml +29 -29
  174. data/data/solutions/reddit/ruby/2022/06.yml +38 -38
  175. data/data/solutions/reddit/ruby/2022/07.yml +25 -25
  176. data/data/solutions/reddit/ruby/2022/08.yml +9 -9
  177. data/data/solutions/reddit/ruby/2022/09.yml +18 -18
  178. data/data/solutions/reddit/ruby/2022/10.yml +14 -14
  179. data/data/solutions/reddit/ruby/2022/11.yml +7 -7
  180. data/data/solutions/reddit/ruby/2022/12.yml +2 -2
  181. data/data/solutions/reddit/ruby/2022/13.yml +9 -9
  182. data/data/solutions/reddit/ruby/2022/14.yml +5 -5
  183. data/data/solutions/reddit/ruby/2022/15.yml +6 -6
  184. data/data/solutions/reddit/ruby/2022/16.yml +5 -5
  185. data/data/solutions/reddit/ruby/2022/17.yml +2 -2
  186. data/data/solutions/reddit/ruby/2022/18.yml +6 -6
  187. data/data/solutions/reddit/ruby/2022/19.yml +3 -3
  188. data/data/solutions/reddit/ruby/2022/20.yml +12 -12
  189. data/data/solutions/reddit/ruby/2022/21.yml +11 -11
  190. data/data/solutions/reddit/ruby/2022/22.yml +4 -4
  191. data/data/solutions/reddit/ruby/2022/24.yml +10 -10
  192. data/data/solutions/reddit/ruby/2022/25.yml +10 -10
  193. data/data/solutions/reddit/ruby/2023/01.yml +52 -52
  194. data/data/solutions/reddit/ruby/2023/02.yml +21 -21
  195. data/data/solutions/reddit/ruby/2023/03.yml +18 -18
  196. data/data/solutions/reddit/ruby/2023/04.yml +31 -31
  197. data/data/solutions/reddit/ruby/2023/05.yml +14 -14
  198. data/data/solutions/reddit/ruby/2023/06.yml +24 -24
  199. data/data/solutions/reddit/ruby/2023/07.yml +32 -32
  200. data/data/solutions/reddit/ruby/2023/08.yml +20 -20
  201. data/data/solutions/reddit/ruby/2023/09.yml +32 -32
  202. data/data/solutions/reddit/ruby/2023/10.yml +18 -18
  203. data/data/solutions/reddit/ruby/2023/11.yml +16 -16
  204. data/data/solutions/reddit/ruby/2023/12.yml +5 -5
  205. data/data/solutions/reddit/ruby/2023/13.yml +6 -6
  206. data/data/solutions/reddit/ruby/2023/14.yml +14 -14
  207. data/data/solutions/reddit/ruby/2023/15.yml +13 -13
  208. data/data/solutions/reddit/ruby/2023/16.yml +8 -8
  209. data/data/solutions/reddit/ruby/2023/18.yml +5 -5
  210. data/data/solutions/reddit/ruby/2023/19.yml +6 -6
  211. data/data/solutions/reddit/ruby/2023/20.yml +9 -9
  212. data/data/solutions/reddit/ruby/2023/21.yml +5 -5
  213. data/data/solutions/reddit/ruby/2023/22.yml +2 -2
  214. data/data/solutions/reddit/ruby/2023/23.yml +1 -1
  215. data/data/solutions/reddit/ruby/2023/25.yml +1 -1
  216. data/data/solutions/reddit/ruby/2024/01.yml +15 -15
  217. data/data/solutions/reddit/ruby/2024/02.yml +17 -17
  218. data/data/solutions/reddit/ruby/2024/03.yml +43 -43
  219. data/data/solutions/reddit/ruby/2024/04.yml +18 -18
  220. data/data/solutions/reddit/ruby/2024/05.yml +29 -29
  221. data/data/solutions/reddit/ruby/2024/06.yml +19 -19
  222. data/data/solutions/reddit/ruby/2024/07.yml +26 -26
  223. data/data/solutions/reddit/ruby/2024/08.yml +15 -15
  224. data/data/solutions/reddit/ruby/2024/09.yml +5 -5
  225. data/data/solutions/reddit/ruby/2024/10.yml +9 -9
  226. data/data/solutions/reddit/ruby/2024/11.yml +15 -15
  227. data/data/solutions/reddit/ruby/2024/12.yml +9 -9
  228. data/data/solutions/reddit/ruby/2024/13.yml +10 -10
  229. data/data/solutions/reddit/ruby/2024/14.yml +6 -6
  230. data/data/solutions/reddit/ruby/2024/15.yml +5 -5
  231. data/data/solutions/reddit/ruby/2024/16.yml +4 -4
  232. data/data/solutions/reddit/ruby/2024/17.yml +11 -11
  233. data/data/solutions/reddit/ruby/2024/18.yml +9 -9
  234. data/data/solutions/reddit/ruby/2024/19.yml +16 -16
  235. data/data/solutions/reddit/ruby/2024/20.yml +8 -8
  236. data/data/solutions/reddit/ruby/2024/21.yml +3 -3
  237. data/data/solutions/reddit/ruby/2024/22.yml +8 -8
  238. data/data/solutions/reddit/ruby/2024/23.yml +13 -13
  239. data/data/solutions/reddit/ruby/2024/24.yml +7 -7
  240. data/data/solutions/reddit/ruby/2024/25.yml +14 -14
  241. data/lib/arb/api/aoc.rb +2 -2
  242. data/lib/arb/cli/run.rb +2 -3
  243. data/lib/arb/version.rb +1 -1
  244. data/lib/download_solutions/api/reddit/get_serial_comments.rb +1 -1
  245. metadata +2 -2
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  - :author: brushbox
3
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmyyybi/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmyyybi
4
4
  :body: |-
5
5
  # Ruby
6
6
 
@@ -15,18 +15,18 @@
15
15
  input.each_cons(3).map(&:sum).each_cons(2).select { |a,b| a \< b }.count
16
16
  :replies:
17
17
  - :author: waitingformsfs2020
18
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hqtops0/
18
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hqtops0
19
19
  :body: I was learning ruby and now I will start college so i gotta learn C. I hate how complicated C is.
20
20
  :replies:
21
21
  - :author: brushbox
22
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hquu30n/
22
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hquu30n
23
23
  :body: |-
24
24
  C may be complicated but it is worth learning for many reasons. Not least is that many other languages are implemented in C (including Ruby). It helps you appreciate the work that has been put in to make your favourite language so pleasant to use.
25
25
 
26
26
  Good luck in college!
27
27
  :replies: []
28
28
  - :author: zloth
29
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hoswr4d/
29
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hoswr4d
30
30
  :body: |-
31
31
  copy/paste typo perhaps?
32
32
 
@@ -35,7 +35,7 @@
35
35
  ```
36
36
  :replies: []
37
37
  - :author: retro__grade
38
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmylktx/
38
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmylktx
39
39
  :body: |-
40
40
  **Ruby (part 1):**
41
41
 
@@ -56,11 +56,11 @@
56
56
  ```
57
57
  :replies: []
58
58
  - :author: dtinth
59
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrf5u4/
59
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrf5u4
60
60
  :body: "```ruby\n# Ruby, 1381 / 452\np $<.read.split.map(&:to_i).each_cons(2).count{|a,b|b>a}\np $<.read.split.map(&:to_i).each_cons(3).map(&:sum).each_cons(2).count{|a,b|b>a}\n```\n\nI made 2 silly mistakes (e.g. forgot to convert to int and used the wrong comparison operator). Next time I will remember to test with example data first \U0001F604\n\nEdit: Thanks to the suggestions by u/gurgeous, u/BluFoot, u/442401, the above can be improved like this:\n\n```ruby\np $<.each_cons(2).count{_2.to_i>_1.to_i}\np $<.map(&:to_i).each_cons(3).each_cons(2).count{_2.sum>_1.sum}\n```"
61
61
  :replies:
62
62
  - :author: BluFoot
63
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrgkpw/
63
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrgkpw
64
64
  :body: |-
65
65
  Nice, I golfed mine down to the same thing with a couple extra simplifications. The `.read.split` isn't necessary
66
66
 
@@ -69,14 +69,14 @@
69
69
  ```
70
70
  :replies:
71
71
  - :author: '442401'
72
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrhejm/
72
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrhejm
73
73
  :body: |-
74
74
  Save a few bytes by not mapping
75
75
 
76
76
  `p $<.map(&:to_i).each_cons(3).each_cons(2).count{|a,b|a.sum<b.sum}`
77
77
  :replies:
78
78
  - :author: BluFoot
79
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrlbs0/
79
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrlbs0
80
80
  :body: |-
81
81
  And I upgrade to ruby 3 just to save a few more! Down to **63 bytes** , pretty good.
82
82
 
@@ -85,7 +85,7 @@
85
85
  ```
86
86
  :replies:
87
87
  - :author: '442401'
88
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmryop9/
88
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmryop9
89
89
  :body: |-
90
90
  edit: **48 bytes**
91
91
 
@@ -96,34 +96,34 @@
96
96
  `p $<.map(&:to_i).each_cons(4).count{_1[0]<_1[3]}`
97
97
  :replies:
98
98
  - :author: BluFoot
99
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmszy2s/
99
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmszy2s
100
100
  :body: |-
101
101
  What is this sorcery??
102
102
 
103
103
  Edit: ahhh, the middle ones cancel out, makes sense.
104
104
  :replies: []
105
105
  - :author: dtinth
106
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrh40r/
106
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrh40r
107
107
  :body: 'Thanks! TIL: `$\<` is an Enumerable that yields each line from stdin.'
108
108
  :replies:
109
109
  - :author: "[deleted]"
110
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrslua/
110
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrslua
111
111
  :body: i think it's the same as ARGF
112
112
  :replies:
113
113
  - :author: dtinth
114
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms8pys/
114
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms8pys
115
115
  :body: I just checked, you're right, `$<` is `ARGF`. I didn't know until today that `ARGF` is also an Enumerable.
116
116
  :replies: []
117
117
  - :author: gurgeous
118
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmri8mc/
118
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmri8mc
119
119
  :body: Also try using \_1 and \_2 instead of a & b. Added in 2.7. Once you start using numbered params you'll never go back!
120
120
  :replies:
121
121
  - :author: dtinth
122
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrl0yo/
122
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrl0yo
123
123
  :body: That’s another TIL. My Ruby is so rusty.
124
124
  :replies: []
125
125
  - :author: '442401'
126
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrnyjp/
126
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrnyjp
127
127
  :body: |-
128
128
  Like you, I also wasted an awful lot of time by not converting to int. But, I don't understand why the result would differ? (For me, it was off by 1)
129
129
 
@@ -132,11 +132,11 @@
132
132
  (Part 2 would have got us in the end anyway)
133
133
  :replies:
134
134
  - :author: dtinth
135
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms8uoh/
135
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms8uoh
136
136
  :body: Probably because `'120' < '50'` but `120 > 50`.
137
137
  :replies:
138
138
  - :author: '442401'
139
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9dlv/
139
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9dlv
140
140
  :body: |-
141
141
  Ahhh! Of course!
142
142
 
@@ -147,7 +147,7 @@
147
147
  Thank you.
148
148
  :replies: []
149
149
  - :author: CodeIsTheEnd
150
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrkw73/
150
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrkw73
151
151
  :body: |-
152
152
  **Ruby** : 1:37/3:44, 370/280
153
153
 
@@ -156,15 +156,15 @@
156
156
  Pretty standard Day 1. Might've made the leaderboard for Part 1 if I didn't get a 504, who knows though. Definitely not for Part 2.
157
157
  :replies:
158
158
  - :author: _jstanley
159
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrn4y5/
159
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrn4y5
160
160
  :body: Rotten luck on the 504s! Nice work.
161
161
  :replies: []
162
162
  - :author: '442401'
163
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms181y/
163
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms181y
164
164
  :body: "Wow!\n\nThanks for sharing.\n\nIt's this type of thinking that blows my mind every year. Here's me doing `each_cons(3).each_cons(2).count{...}` and you're just like \"nah, as long as the one 4 in front is bigger, we're good\"\n\n\U0001F92F"
165
165
  :replies: []
166
166
  - :author: damyvv
167
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms968d/
167
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms968d
168
168
  :body: |-
169
169
  # Ruby
170
170
 
@@ -175,7 +175,7 @@
175
175
  ```
176
176
  :replies:
177
177
  - :author: Initial_Soil_9261
178
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9h99/
178
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9h99
179
179
  :body: |-
180
180
  similar to mine:
181
181
 
@@ -186,11 +186,11 @@
186
186
  ```
187
187
  :replies:
188
188
  - :author: damyvv
189
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsae2s/
189
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsae2s
190
190
  :body: Nice one! I didn't actually think about comparing the outer values of the sliding window. Good find.
191
191
  :replies: []
192
192
  - :author: petercooper
193
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsgjyv/
193
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsgjyv
194
194
  :body: |-
195
195
  Just for the sake of anyone who finds it interesting, you can now also do this in Ruby 3.0+:
196
196
 
@@ -201,15 +201,15 @@
201
201
  I imagine some may prefer or not prefer this - definitely a matter of taste!
202
202
  :replies: []
203
203
  - :author: SadBunnyNL
204
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9ae6/
204
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9ae6
205
205
  :body: I really gotta start learning that stuff... It always looks so powerful and generally purposeful, yet I never get around to it! Thanks for your solution.
206
206
  :replies:
207
207
  - :author: damyvv
208
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9v1q/
208
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms9v1q
209
209
  :body: Hallo mede-Nederlander ;). Thanks for your comment, I will post all my solutions [here]([https://github.com/damyvv/advent-of-code-2021](https://github.com/damyvv/advent-of-code-2021)). And you can find all my solutions from last year [here]([https://github.com/damyvv/AoC\_2020](https://github.com/damyvv/AoC_2020)). Ruby is so powerful, I truly enjoy coding with it. If you have any questions about Ruby, let me know, I'll be happy to answer them if I can.
210
210
  :replies: []
211
211
  - :author: gurgeous
212
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrfgli/
212
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrfgli
213
213
  :body: |-
214
214
  Ruby. I was fast, but not as fast as you guys!
215
215
 
@@ -219,7 +219,7 @@
219
219
  ```
220
220
  :replies:
221
221
  - :author: '442401'
222
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrh2io/
222
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrh2io
223
223
  :body: |-
224
224
  Nice.
225
225
 
@@ -228,37 +228,37 @@
228
228
  `p data.each_cons(3).each_cons(2).count { _1.sum < _2.sum }`
229
229
  :replies: []
230
230
  - :author: flwyd
231
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmri827/
231
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmri827
232
232
  :body: Whoa, I didn't realize Ruby had implicit block parameters (which is what I assume `_1` is). Is that a relatively new feature?
233
233
  :replies:
234
234
  - :author: gurgeous
235
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrih3f/
235
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrih3f
236
236
  :body: Added in 2.7 and quite handy! I use it everywhere now, both at work and for advent. I appreciate not having to make up silly param names for simple code.
237
237
  :replies: []
238
238
  - :author: "[deleted]"
239
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrsexd/
239
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrsexd
240
240
  :body: why do you need the `.map` in `.map.each_cons`?
241
241
  :replies: []
242
242
  - :author: "[deleted]"
243
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrky8s/
243
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrky8s
244
244
  :body: |-
245
245
  Ruby
246
246
 
247
247
  https://github.com/sreedevk/advent-of-code/blob/master/ruby/2021/day1/main.rb
248
248
  :replies:
249
249
  - :author: '442401'
250
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrlox0/
250
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrlox0
251
251
  :body: |-
252
252
  Nice.
253
253
 
254
254
  No need to `select` & `count`, just `count` ;-)
255
255
  :replies:
256
256
  - :author: "[deleted]"
257
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrmjlk/
257
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrmjlk
258
258
  :body: Thank you! :D Updated!
259
259
  :replies: []
260
260
  - :author: p_tseng
261
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrmz20/
261
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrmz20
262
262
  :body: |-
263
263
  ### Ruby
264
264
 
@@ -276,11 +276,11 @@
276
276
  Yes this solution actually works. No you don't need to tell me [the better way to do it](https://github.com/petertseng/adventofcode-rb-2021/blob/master/01_sonar_sweep.rb), thanks :)
277
277
  :replies:
278
278
  - :author: jenneh03
279
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrpxy4/
279
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrpxy4
280
280
  :body: Can someone explain this to me? I'm not too familiar with Ruby
281
281
  :replies:
282
282
  - :author: p_tseng
283
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrtf4p/
283
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrtf4p
284
284
  :body: |-
285
285
  Try on the example input. Result of annotating each element with its index, and then sorting them by (value ascending, index descending):
286
286
 
@@ -306,15 +306,15 @@
306
306
  For part 2 it's: No, no, no, no, no, yes, yes, yes, yes, yes, for an answer of 5.
307
307
  :replies:
308
308
  - :author: jenneh03
309
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrtprz/
309
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrtprz
310
310
  :body: "Thank you for the explanation. I love this \U0001F601"
311
311
  :replies: []
312
312
  - :author: '442401'
313
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrqazv/
313
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrqazv
314
314
  :body: "\U0001F92F"
315
315
  :replies: []
316
316
  - :author: "[deleted]"
317
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrq8km/
317
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrq8km
318
318
  :body: |-
319
319
  ## Ruby
320
320
 
@@ -333,7 +333,7 @@
333
333
  ```
334
334
  :replies: []
335
335
  - :author: mddubey
336
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmwgxfw/
336
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmwgxfw
337
337
  :body: |-
338
338
  Love ruby and how rich it is in terms of different methods.
339
339
 
@@ -342,7 +342,7 @@
342
342
  (https://github.com/mddubey/AoC/blob/main/2021/001/solution.rb)
343
343
  :replies: []
344
344
  - :author: joeyGibson
345
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmu09qs/
345
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmu09qs
346
346
  :body: |-
347
347
  I'm doing it all in Python this year, after doing it all in Ruby last year. Here's today's solution.
348
348
 
@@ -377,7 +377,7 @@
377
377
  ```
378
378
  :replies: []
379
379
  - :author: snowe2010
380
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmv10v7/
380
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmv10v7
381
381
  :body: |-
382
382
  Ruby:
383
383
 
@@ -413,7 +413,7 @@
413
413
  I've modified the kotlin one quite a number of times using discoveries from this thread.
414
414
  :replies: []
415
415
  - :author: zxywx
416
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrr4l8/
416
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrr4l8
417
417
  :body: |-
418
418
  # Ruby
419
419
 
@@ -436,15 +436,15 @@
436
436
  ```
437
437
  :replies:
438
438
  - :author: riffraff
439
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrsn0t/
439
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrsn0t
440
440
  :body: you don't need `chomp`, as `"1\n".to_i` is the same as `"1".to_i` . Also, you can use `.count` rather than `inject` :)
441
441
  :replies:
442
442
  - :author: zxywx
443
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrt8gk/
443
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrt8gk
444
444
  :body: Good call! Thanks
445
445
  :replies: []
446
446
  - :author: zxywx
447
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms0thz/
447
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms0thz
448
448
  :body: |-
449
449
  Refactored ... much tidier, thanks!
450
450
 
@@ -472,14 +472,14 @@
472
472
  ```
473
473
  :replies: []
474
474
  - :author: LyleiLanar
475
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms2ee2/
475
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hms2ee2
476
476
  :body: |-
477
477
  My ruby solution: [[2021 Day 1]](https://github.com/LyleiLanar/advent-of-code/blob/main/2021/day_1.rb)
478
478
 
479
479
  Not the best, but Ruby is very new for me.
480
480
  :replies: []
481
481
  - :author: ni3t
482
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsqyxj/
482
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsqyxj
483
483
  :body: |-
484
484
  # Ruby (4644/4137)
485
485
 
@@ -496,11 +496,11 @@
496
496
  ```
497
497
  :replies:
498
498
  - :author: Albeit-it-does-move
499
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hq6rjd9/
499
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hq6rjd9
500
500
  :body: I like the idea but if this code is giving you the right answer it might be by pure luck... Since you are reading triplets for part 2 it means neither will the last b will be compared to c, nor the last c to the last d for part 1. So if the two last values of your input are increases over previous values then the final count for part 1 will be two lower than it should be.
501
501
  :replies: []
502
502
  - :author: KennyEvil
503
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsrqka/
503
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsrqka
504
504
  :body: |-
505
505
  Day 1 Ruby (I loaded the values into an array called depths)
506
506
 
@@ -517,15 +517,15 @@
517
517
  puts increase\_count
518
518
  :replies:
519
519
  - :author: oantolin
520
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsui9j/
520
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmsui9j
521
521
  :body: Avoiding computing the sums of the sliding windows in the second part is clever!
522
522
  :replies:
523
523
  - :author: KennyEvil
524
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmt32ch/
524
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmt32ch
525
525
  :body: Thanks. It was just something I realised when I was working it out in my head, that the difference between the first and fourth input was ultimately what mattered. Meant I could keep it to one line as well.
526
526
  :replies: []
527
527
  - :author: oantolin
528
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmt3jqm/
528
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmt3jqm
529
529
  :body: |-
530
530
  My Ruby is rusty, but I think there is a count method that would let you eliminate the increase\_count variable:
531
531
 
@@ -534,32 +534,32 @@
534
534
  ```
535
535
  :replies: []
536
536
  - :author: ywecur
537
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmto3j9/
537
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmto3j9
538
538
  :body: |-
539
539
  Ruby has `each_cons` which implements the sliding window method
540
540
 
541
541
  https://apidock.com/ruby/Enumerable/each\_cons
542
542
  :replies: []
543
543
  - :author: jeffers0n
544
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmtw0cl/
544
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmtw0cl
545
545
  :body: 'Got a late start today but here''s my solution in ruby: https://git.doublehack.me/s00ner/AoC2021/src/branch/master/day01/solution.rb'
546
546
  :replies: []
547
547
  - :author: roundscribehector5
548
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmxrx3s/
548
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmxrx3s
549
549
  :body: |-
550
550
  [OOP Ruby Solution](https://topaz.github.io/paste/#XQAAAQD/BAAAAAAAAAA5GUqKNoFH6SMnPH0B27EPd7phjZ68/oO/XvGYmYMktKdLulbGgcNEq/E84SnUm1E0wSzPmrFBBtb4l860QuYAXUa0V1ZoR3tERaCFhLQxpDPGY0kSeBv9tfnd5kV9ZhqpO/Zz4Mi7w3Sw2u8hFBScffCn2eLyc6NeS7ui1/J9OXx4t1yqxGelCWouCPTaW1Qe4WnHz24r+hSmMa4zXqoho94I9f/HW5X2+jrjCU/jDL3fHgC+dugtCUAGg+B3sfeLg9s6FMGa0NSbSNzV0cBJV4LzMUHI5ToaK1k8r0gscf2zqieY3xAmJmqhNC0l1YoeocPd13/sFQYlkTQf3bJSCtFcJWAjhPW5A3Ce8PLVEc/F/+zWKxwj4KhqhDPrTj7Kw4MMcKKhCPpia8y+Z9IYu0oEIDj+iS4e0qIieI/DC792ipEUtWIyUaulWckc84PSFLg2p+68x/asb2H5qFuwCb/MatJXaETHQyHZt83LVdgAGmQaV5mNt5uTEbHluHBXtw+oURed5fCK/FI/TFi+UxmKhawHMebxwLNqMw276noz1bXgeCuxEahvgKwmahh4W7Op6doHZmD8c8blHP/7gaEY)
551
551
 
552
552
  I'd appreciate any feedback.
553
553
  :replies: []
554
554
  - :author: frontpageminus
555
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrel8t/
555
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmrel8t
556
556
  :body: |-
557
557
  Ruby 930/626
558
558
 
559
559
  [paste](https://topaz.github.io/paste/#XQAAAQDLAQAAAAAAAAARiAqGkkN7pOxE/i+5OLDe05IXgS2qncloTxIqhlc9i6FuSU224aGk++UCtFvqS/pAFLhmHr2+ryAX6wkyWrE/xAWAY66qogr6zl3OnESY8FEIXZBLlC+f3MD8UmbUkyCP4SHfO7irP0dTJAEOvviNiuYn5/O4GzFfwnmGduXdbaAvR3qH1uTDzkkb4C+B+dUq7cYkcSXT+OHYBOtnQDTDZWQ4fDVHZRFtYitXRg0RHtn9SCXFngt4Id39RhiVxQeoY0wOUQBMFuAOZi4rvMYWPrnmwM0WQgh1CGD+9T+7Aw==)
560
560
  :replies: []
561
561
  - :author: Happy_Laulo_33
562
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmu2d91/
562
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmu2d91
563
563
  :body: |-
564
564
  In ruby :
565
565
 
@@ -586,37 +586,37 @@
586
586
  count
587
587
  :replies: []
588
588
  - :author: Robert_TT
589
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmuc4p0/
589
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmuc4p0
590
590
  :body: |-
591
591
  [Part1(Ruby)](https://imgur.com/a/OBn7fA1)
592
592
 
593
593
  [Part2[Ruby]](https://imgur.com/a/dPwGJT0)
594
594
  :replies:
595
595
  - :author: snowe2010
596
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmv4m2n/
596
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmv4m2n
597
597
  :body: |-
598
598
  can you indent your code so it's put in code blocks?
599
599
 
600
600
  also, have you seen the ruby method [`each_cons`](https://ruby-doc.org/core-3.0.2/Enumerable.html#method-i-each_cons)?
601
601
  :replies:
602
602
  - :author: Robert_TT
603
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmwcpgg/
603
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmwcpgg
604
604
  :body: I did, I am extremely sorry, I did it like 5 times and it doesn't work in the reddit code blocks for some reason :(. Sorry
605
605
  :replies:
606
606
  - :author: snowe2010
607
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmydf36/
607
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmydf36
608
608
  :body: You have to add 4 spaces before every line, and you also have to have blank lines before and after your code.
609
609
  :replies:
610
610
  - :author: Robert_TT
611
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmyf4r0/
611
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmyf4r0
612
612
  :body: thank you for explaining !
613
613
  :replies: []
614
614
  - :author: Robert_TT
615
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmyf3ht/
615
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmyf3ht
616
616
  :body: I haven't used the each cons method yet, thank you for the suggestion!
617
617
  :replies: []
618
618
  - :author: antoniotto
619
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmucq9b/
619
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmucq9b
620
620
  :body: |-
621
621
  This is my solution in Ruby:
622
622
 
@@ -637,7 +637,7 @@
637
637
  answer2 = increments\_by3.count('increased')
638
638
  :replies:
639
639
  - :author: snowe2010
640
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmv1anu/
640
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmv1anu
641
641
  :body: |-
642
642
  several suggestions for shortening your code and making it a bit more readable
643
643
 
@@ -648,22 +648,22 @@
648
648
  Here's my solution if you care. https://github.com/snowe2010/advent-of-code/blob/master/ruby\_aoc/2021/day01/day01.rb
649
649
  :replies:
650
650
  - :author: '442401'
651
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmve0d5/
651
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmve0d5
652
652
  :body: I haven't tested it, but I'm confident part 2 works. Summing is not necessary. The middle 2 values cancel each other out.
653
653
  :replies:
654
654
  - :author: snowe2010
655
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvgddu/
655
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvgddu
656
656
  :body: I learned that from another comment, thank you. Wouldn’t you need to each\_cons(4) though?
657
657
  :replies:
658
658
  - :author: '442401'
659
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvs6r3/
659
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvs6r3
660
660
  :body: |-
661
661
  I would imagine that if OP posted it here, it works.
662
662
 
663
663
  I really don't want to look at it any longer than possible though, because the absence of formatting makes my eyes hurt.
664
664
  :replies: []
665
665
  - :author: antoniotto
666
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvef6w/
666
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvef6w
667
667
  :body: |-
668
668
  Thank you for your suggestions, I realize now the second part should be, in my original style, like:
669
669
 
@@ -678,6 +678,6 @@
678
678
  Still have to try the count block option.
679
679
  :replies:
680
680
  - :author: snowe2010
681
- :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvgwlt/
681
+ :url: https://www.reddit.com/r/adventofcode/comments/r66vow/2021_day_1_solutions/hmvgwlt
682
682
  :body: Somebody actually pointed out that you don’t actually have to do any summing, which means you were actually almost right the first time. I think you just have to each\_cons(4) instead.
683
683
  :replies: []