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,21 +1,21 @@
1
1
  ---
2
2
  - :author: Stronbold
3
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m0gyoci/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m0gyoci
4
4
  :body: "[Solution](https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day02.rb)"
5
5
  :replies: []
6
6
  - :author: HAEC_EST_SPARTA
7
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m0c085b/
7
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m0c085b
8
8
  :body: |-
9
9
  [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2024-ruby/item/lib/day02.rb)
10
10
 
11
11
  Not much to report (_ba-dum tsss_) for this one: I used a basic regex for parsing and was able to use the same safety evaluation function for Part 1 and (a painfully brute-force) Part 2. I was able to express the strictly increasing/decreasing criterion mostly within a single line, which is somewhat satisfying; additionally, I added a new function, `Integer#signum`, to my extensions library since these types of classifications have been common in years past.
12
12
  :replies: []
13
13
  - :author: careyi4
14
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m06h0vq/
14
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m06h0vq
15
15
  :body: "[https://github.com/careyi3/aoc\\_2024/tree/master/solutions/2](https://github.com/careyi3/aoc_2024/tree/master/solutions/2)"
16
16
  :replies: []
17
17
  - :author: riffraff
18
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/lzzx7xs/
18
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/lzzx7xs
19
19
  :body: |-
20
20
  I'm just going to say, this is the first version of my solution for part 1, I could not think of a valid way to say "this is not inc or dec" beyond rand(). I'm lucky it worked :D
21
21
 
@@ -38,18 +38,18 @@
38
38
  I know pt 2 can be done in linear time but I'm too sleepy and just went with brute force https://gist.github.com/riffraff/415f78c833ac6257951c7e013e93a706
39
39
  :replies: []
40
40
  - :author: adherry
41
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00r8jc/
41
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00r8jc
42
42
  :body: |-
43
43
  [https://github.com/adherry/AOC2024/blob/main/aoc2.rb](https://github.com/adherry/AOC2024/blob/main/aoc2.rb)
44
44
 
45
45
  Was pondering quite a bit about the second part until i checked the array functions and found `array.combine` that when called as `array.combine(array.length -1)` will give me all variations of an array with a single element removed.
46
46
  :replies:
47
47
  - :author: '442401'
48
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m09z9lg/
48
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m09z9lg
49
49
  :body: Nice find.
50
50
  :replies: []
51
51
  - :author: The_Jare
52
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m02he32/
52
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m02he32
53
53
  :body: |-
54
54
  ```ruby
55
55
  nums = ARGF.each.map { | l | l.split.map(&:to_i) }
@@ -64,7 +64,7 @@
64
64
  ```
65
65
  :replies: []
66
66
  - :author: Sharparam
67
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/lzzw6uc/
67
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/lzzw6uc
68
68
  :body: |-
69
69
  ```ruby
70
70
  reports = ARGF.map { |line| line.split.map(&:to_i) }
@@ -91,7 +91,7 @@
91
91
  Initially had something way wordier but managed to condense it a little at least. Still feels way too verbose though.
92
92
  :replies:
93
93
  - :author: Sharparam
94
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/lzzyf2x/
94
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/lzzyf2x
95
95
  :body: |-
96
96
  Of course, after checking some other solutions in this thread I realize it can be shortened several lines by using `combination`:
97
97
 
@@ -112,15 +112,15 @@
112
112
  ```
113
113
  :replies:
114
114
  - :author: Maravedis
115
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m006u16/
115
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m006u16
116
116
  :body: I don't even think you need the `validate(report) ||` in `validate2`, since if a report is valid without mistake, then removing one always makes it a valid report still.
117
117
  :replies:
118
118
  - :author: Sharparam
119
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00blwl/
119
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00blwl
120
120
  :body: That's probably true, in an already valid report, removing the first or last element will make it still be valid. Good catch!
121
121
  :replies: []
122
122
  - :author: _tfa
123
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m010hfe/
123
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m010hfe
124
124
  :body: |-
125
125
  Part 1
126
126
 
@@ -147,14 +147,14 @@
147
147
  ```
148
148
  :replies: []
149
149
  - :author: FCBStar-of-the-South
150
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m03eo4i/
150
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m03eo4i
151
151
  :body: |-
152
152
  [paste](https://topaz.github.io/paste/#XQAAAQDdAgAAAAAAAAA2GkofDKPu58w0EHSiMBIPN58ZrE9yw9d+ctWKcaSkOKfcmYiy2wP4+D4BSgAd5xpef/i0FFExLUzl8+s3srYAeYV5C84s00uBfTf6IfDuMqSYX979rxWt4A6rhyFOEJkGgG4g3u2D3nuHlCc4s73egxXwgJZE6RHkA9KvxGL6FIObMJQqGkPk6bDqCb68JbzfvjIqP9umTLpR2VV6b1DxPue/qU2jPwfg5Fsc9DlODkb5VwGyYzle711NuiKYzpgl2t7/4CFydG4XrOvU+8i7711FRlHOSzn0BcG9YpopQW3yp7oVfhN/ta4+54cBrMTJpArHoMlEKpQlRGA1gBXqLFA4aFI6cDvLimx02ARU51/6pqL5dZqWpZJt0CvjQlpOWQb9EY6h8PuLIzu7xMD3pLAecg0LKFSKIToaUxU5pLZ+h0ELY72iHyiFI9womjv1mif6uvAX/1ossQA=)
153
153
 
154
154
  O(n^2) brute force. Cannot imagine doing this in one pass but two pass is likely possible. That logic will probably be quite involved and I have other things to do.
155
155
  :replies: []
156
156
  - :author: XtremeNolaner
157
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m045adg/
157
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m045adg
158
158
  :body: |-
159
159
  ```ruby
160
160
  def safety_check(report)
@@ -205,7 +205,7 @@
205
205
  ```
206
206
  :replies: []
207
207
  - :author: zaniwoop
208
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00w9fv/
208
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00w9fv
209
209
  :body: |-
210
210
  ```ruby
211
211
  input = File.read("day_2_data.txt")
@@ -259,7 +259,7 @@
259
259
  ```
260
260
  :replies: []
261
261
  - :author: Screech-1
262
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m02ns7r/
262
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m02ns7r
263
263
  :body: |-
264
264
  ```ruby
265
265
 
@@ -267,7 +267,7 @@
267
267
  ```
268
268
  :replies: []
269
269
  - :author: masterarms
270
- :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00m5vv/
270
+ :url: https://www.reddit.com/r/adventofcode/comments/1h4ncyr/2024_day_2_solutions/m00m5vv
271
271
  :body: |-
272
272
  ```ruby
273
273
  reports = input.lines.map { |l|
@@ -1,17 +1,17 @@
1
1
  ---
2
2
  - :author: Stronbold
3
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0g5wom/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0g5wom
4
4
  :body: "[Solution](https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day03.rb)"
5
5
  :replies: []
6
6
  - :author: HAEC_EST_SPARTA
7
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bzqyo/
7
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bzqyo
8
8
  :body: |-
9
9
  [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2024-ruby/item/lib/day03.rb)
10
10
 
11
11
  I ended up using a disgusting regex for the parsing and somewhat overengineered the instruction execution by using separate `Data` classes for the two different instruction variants; the latter choice did allow me to implement both parts almost entirely through pattern matching, which is pretty fun!
12
12
  :replies: []
13
13
  - :author: _tfa
14
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bu7nh/
14
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bu7nh
15
15
  :body: |-
16
16
  Part 1
17
17
 
@@ -35,7 +35,7 @@
35
35
  ```
36
36
  :replies:
37
37
  - :author: chad3814
38
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0dy5n4/
38
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0dy5n4
39
39
  :body: |-
40
40
  I don't grok Ruby, but I think your part 2 fails if line ends in the middle of a `mul(xxx,yyy)` or a `do()` or `don't` like:
41
41
 
@@ -48,11 +48,11 @@
48
48
  probably should've replaced `\n` with `.` or something not in any of the target strings since newlines are terminators
49
49
  :replies: []
50
50
  - :author: ArmlessJohn404
51
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0cj7oo/
51
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0cj7oo
52
52
  :body: Yeah same! I just added a single line flag to the don't/do regex and it worked
53
53
  :replies: []
54
54
  - :author: '442401'
55
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0ba4fc/
55
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0ba4fc
56
56
  :body: |-
57
57
  I really wanted to use the flip-flop operator for this, but I couldn't figure it out.
58
58
 
@@ -61,7 +61,7 @@
61
61
  [pastie](https://topaz.github.io/paste/#XQAAAQCcAgAAAAAAAAARiEJHiiMzw3cPM/1Vl+2nyBa63n8KxkURAq1MNsPYeLWddbrnT8FYoEKNLOua2iFodHtPGBqac9YqLaxMc20XwhUjJJhFP49euI9938JlvVqHXre8Q6IGGRDRQhWGUC8yPJoTN5Zt1yHA0E2SralkypvbZYsrWfRpZjxgal7yKmUwGL69u2Ym27P278yrLQZyfA1qYz0rLBcwo/Y0xEGVKFdTZctEcwXW/B7Izkylw1m97Xls5Bsmbg8htOcqetravgWSB9Zv9jPnsUZ9JOYXD8gm1FflhyvLq8glOdk15/lwoC345JfFmR4P3J/o9JoNtn5YoVwVZFvcKIvW2aBBpwycyUZPa5SMZzzSGQ1jiBUGnGgaokCJaMBFXjLdsEvzSQE62OkIM3UZJBfF3S5UXQIJCcSUw45rxSewUs931DWTZizNUGoUlVcH8Qybg2+XAczjNcoQYdYWg4E1DbzpGCMLEtwwm/636+HbWLoIwyFlYi0YmP7RknpuAdX/7f/LFA==)
62
62
  :replies: []
63
63
  - :author: el_daniero
64
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05xkjv/
64
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05xkjv
65
65
  :body: |-
66
66
  ```ruby
67
67
  input = File.read('input03.txt')
@@ -87,7 +87,7 @@
87
87
  ```
88
88
  :replies:
89
89
  - :author: el_daniero
90
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m07uatk/
90
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m07uatk
91
91
  :body: |-
92
92
  Or, to reuse the logic from part 1 in part 2, just use more regex to remove everything between any `don't()` and `do()`:
93
93
 
@@ -105,14 +105,14 @@
105
105
  ```
106
106
  :replies:
107
107
  - :author: FCBStar-of-the-South
108
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m080f19/
108
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m080f19
109
109
  :body: |-
110
110
  Ah the gsub is very clever. Care explaining why the `m` flag is needed? My [original solution](https://topaz.github.io/paste/#XQAAAQBoAgAAAAAAAAAzGknWt5Bv2qwBBozyqeTA6pRzO8rm9LH3DWozdnfDy8iyMhig1p93ahHDb6Hm4YVLsyVTtbP+9ckmHojS4mzp3HLAe+v06SXohVCYGeu8cdGUmjA2txmHMW5U6j70xhvSVl5zeh5BruZ6IgjU38ID2nAFBU/jxFH2p36G3s/GBe8jNfnKCbSe4yyMfJNzWhNa1bwgRUtbY2Ql2+egDdi79rizLCYkeb1zSvRLU2EQUBeHZrIy48O8R4n04RRB2xaOMp/LpwO4k5xlFkx/cLdipx5naZ40SbDahQnaPfLVsbNXwsJ9PKQllitGsJF+m2ll/ZT9WCuxHP7ND6qizsR9uJHz8rQVMPTOwPdn4FBdNmthq7XBFHTpjhI0gBIUsSSqrrWLNnzUhFGWI2YJViLEwgYMtHg4Kf/vv/Ku) is quite similar to your first attempt but I am going to steal your idea
111
111
 
112
112
  I also didn't know about these special variables. I am using this year's AoC to learn Ruby and so far I am not quite sure how to feel about Ruby syntax haha. Coming from a more Python/C++ background, the amount of sugar and functionality built into the language is pretty crazy
113
113
  :replies:
114
114
  - :author: el_daniero
115
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m08j32i/
115
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m08j32i
116
116
  :body: |-
117
117
  Thanks.
118
118
 
@@ -121,7 +121,7 @@
121
121
  Yup, the language has [a few](https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/variable.html) [obscure](https://codegolf.stackexchange.com/questions/363/tips-for-golfing-in-ruby?answertab=scoredesc#tab-top) quirks :D I've only really been using Ruby for [AoC](https://github.com/daniero/code-challenges/tree/master) and [codegolf](https://codegolf.stackexchange.com/search?tab=relevance&q=user%3a4372%20is%3aa%20ruby&searchOn=3), but it's probably the one language that has been the most influential to me as a programmer. For example, for AoC, it at least _seems_ like the majority of the problems can be solved but nothing but the standard [string](https://ruby-doc.org/core-3.0.1/String.html), [array](https://ruby-doc.org/core-3.0.1/Array.html) and [enumerable](https://ruby-doc.org/core-3.0.1/Enumerable.html) functions, and the API is really super clean. You find yourself just asking "what function is that?" when encounting an obstacle, which lets your focus the bigger picture. Ruby is awesome :)
122
122
  :replies: []
123
123
  - :author: _tfa
124
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bwjb2/
124
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bwjb2
125
125
  :body: |-
126
126
  I had the same problem with the multi-lined input string first. But additonally my input ends with a "don't()" so I had to consider the input's end when removing the dead code
127
127
 
@@ -134,7 +134,7 @@
134
134
  ```
135
135
  :replies: []
136
136
  - :author: vinc686
137
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06d4x1/
137
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06d4x1
138
138
  :body: |-
139
139
  https://github.com/vinc/advent-of-code
140
140
 
@@ -160,15 +160,15 @@
160
160
  Edit: I could replace `map` with `sum` to simplify my answer
161
161
  :replies:
162
162
  - :author: makingthematrix
163
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06ggka/
163
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06ggka
164
164
  :body: Ha, that's a clever use of regex for finding "mul" only between "don't" and "do". Nice :)
165
165
  :replies:
166
166
  - :author: vinc686
167
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06tzzb/
167
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06tzzb
168
168
  :body: The regex also has to handle one or more `don't` at the end of the input, I lost some time before realizing that!
169
169
  :replies: []
170
170
  - :author: im_sofi
171
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m07fpvu/
171
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m07fpvu
172
172
  :body: |-
173
173
  A pretty decent "Do you know Regex?" day.
174
174
 
@@ -177,22 +177,22 @@
177
177
  [https://github.com/soupglasses/advent-of-code/blob/main/2024/ruby/day\_03.rb](https://github.com/soupglasses/advent-of-code/blob/main/2024/ruby/day_03.rb)
178
178
  :replies:
179
179
  - :author: eregontp
180
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0821rp/
180
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0821rp
181
181
  :body: Neat solution to use "optional" capture groups like this
182
182
  :replies: []
183
183
  - :author: SwampThingTom
184
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m082gwc/
184
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m082gwc
185
185
  :body: That part 2 regex is a work of art. Nice job!
186
186
  :replies: []
187
187
  - :author: FCBStar-of-the-South
188
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m083esh/
188
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m083esh
189
189
  :body: |-
190
190
  Nice. I am not super familiar with lookahead/behinds so couldn't figure it out. Glad someone did it with one regex
191
191
 
192
192
  Edit: Is the \z quantifier necessary? Why or why not?
193
193
  :replies: []
194
194
  - :author: FCBStar-of-the-South
195
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0837xn/
195
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0837xn
196
196
  :body: |-
197
197
  ```ruby
198
198
  file = File.read('input3.txt')
@@ -208,7 +208,7 @@
208
208
  By far the best regex experience in any language that I've tried for AoC, and I have tried [a few](https://github.com/Casper-Guo/AoC-Language-Exploration)
209
209
  :replies:
210
210
  - :author: pindab0ter
211
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m089a39/
211
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m089a39
212
212
  :body: |-
213
213
  I wrote the same Regex to filter out the disabled instructions, while also removing anything between last `don't` and the line ending.
214
214
 
@@ -217,11 +217,11 @@
217
217
  Maybe I’m missing some edge case in my input that doesn’t appear in anyone else’s?
218
218
  :replies:
219
219
  - :author: FCBStar-of-the-South
220
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m089ueq/
220
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m089ueq
221
221
  :body: Looks like this solution I have posted would fail to consider the don't to the end edge case. I stole some part 2 ideas from another solution in this thread. My [original solution](https://topaz.github.io/paste/#XQAAAQBoAgAAAAAAAAAzGknWt5Bv2qwBBozyqeTA6pRzO8rm9LH3DWozdnfDy8iyMhig1p93ahHDb6Hm4YVLsyVTtbP+9ckmHojS4mzp3HLAe+v06SXohVCYGeu8cdGUmjA2txmHMW5U6j70xhvSVl5zeh5BruZ6IgjU38ID2nAFBU/jxFH2p36G3s/GBe8jNfnKCbSe4yyMfJNzWhNa1bwgRUtbY2Ql2+egDdi79rizLCYkeb1zSvRLU2EQUBeHZrIy48O8R4n04RRB2xaOMp/LpwO4k5xlFkx/cLdipx5naZ40SbDahQnaPfLVsbNXwsJ9PKQllitGsJF+m2ll/ZT9WCuxHP7ND6qizsR9uJHz8rQVMPTOwPdn4FBdNmthq7XBFHTpjhI0gBIUsSSqrrWLNnzUhFGWI2YJViLEwgYMtHg4Kf/vv/Ku) captured everything of interest separately and kept track of a boolean, which should work more generally.
222
222
  :replies: []
223
223
  - :author: keidax
224
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m09i56j/
224
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m09i56j
225
225
  :body: |-
226
226
  In all my years of writing Ruby, I've never had a use for [the flip-flop operator](https://docs.ruby-lang.org/en/master/syntax/control_expressions_rdoc.html#label-Flip-Flop)... until now
227
227
 
@@ -242,18 +242,18 @@
242
242
  ```
243
243
  :replies:
244
244
  - :author: '442401'
245
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bb7cx/
245
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bb7cx
246
246
  :body: |-
247
247
  This is nice. I really wanted to use the flip-flop but just couldn't quite figure it out.
248
248
 
249
249
  Thanks for sharing.
250
250
  :replies:
251
251
  - :author: keidax
252
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bqrez/
252
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0bqrez
253
253
  :body: You're welcome!
254
254
  :replies: []
255
255
  - :author: Sharparam
256
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05qy6m/
256
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05qy6m
257
257
  :body: |-
258
258
  (317/3510)
259
259
 
@@ -290,7 +290,7 @@
290
290
  Part 1 was very neat with a simple `eval` solution, but then part 2 came and messed it up with the whole `do` business, so I had to re-think my strategy and massage the input some more before it would work.
291
291
  :replies:
292
292
  - :author: Sharparam
293
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05uh1p/
293
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05uh1p
294
294
  :body: |-
295
295
  Man, a solution that doesn't use `eval` actually ends up shorter:
296
296
 
@@ -306,7 +306,7 @@
306
306
  ```
307
307
  :replies: []
308
308
  - :author: riffraff
309
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05vp2x/
309
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05vp2x
310
310
  :body: |-
311
311
  as usual, annoyed that ruby's String#scan does not do named captures, but easy enough
312
312
 
@@ -334,25 +334,25 @@
334
334
  ```
335
335
  :replies: []
336
336
  - :author: marshalofthemark
337
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05t6x7/
337
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05t6x7
338
338
  :body: |-
339
339
  (https://topaz.github.io/paste/#XQAAAQD3AQAAAAAAAAAyGUj/T2CE9ViT6/7BySFNF5fO60VjKKNV35fqvTM71voiintBpJKghjvNGD8+rvCpK2WQ42M9j5JG3XzqNi6NSM18udDST/e+rBLZk5erpVnvfz2/mX1aC0eZ+alyWCAJT8N0Ke1qfNvyumti8WRYPY1xk1z+dCiQxOxz6ZX5AqPybuQYIqFjJVLM0nABL7eQ+NFfRPwo3CI0T7ZxXwVykUtftbAwGx5aWh56mQY7wq4EuTGhx2vQlJyW8nPrKJ8zUNAXPv0jINm76OsGn4PEXil4FBOObU0/jVCYQy6hzX3gh6qmFfZVYCTtGjyK4JkUeKPcfPZUzXV/5iumNWcXh2pzERWC0jRj/E2Ekw==)
340
340
 
341
341
  Spent way too long figuring out why my Part 2 didn't work only to finally realize that I misread: I thought each _line_ started out as enabled until a `don't()` appeared, so I was resetting to enabled after each newline character!
342
342
  :replies:
343
343
  - :author: NealSr
344
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05tl62/
344
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05tl62
345
345
  :body: |-
346
346
  OMG thank you for the hint. I also thought each line was a new batch and was enabled already.
347
347
 
348
348
  It would have been MUCH better if the entire input were on one line, like the samples.
349
349
  :replies: []
350
350
  - :author: lrtDam
351
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05tlj7/
351
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05tlj7
352
352
  :body: Same...took me forever to realize
353
353
  :replies: []
354
354
  - :author: ignurant
355
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0631ah/
355
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m0631ah
356
356
  :body: |-
357
357
  Re: Part 2. First time I've gotten to use the flip flop in ten years of Ruby.
358
358
 
@@ -364,7 +364,7 @@
364
364
  ```
365
365
  :replies: []
366
366
  - :author: masterarms
367
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m064tyu/
367
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m064tyu
368
368
  :body: |-
369
369
  ```ruby
370
370
  part1 = input.scan(/mul\(([0-9]{1,3}),([0-9]{1,3})\)/).map { |mul| mul.map(&:to_i).inject(:*) }.sum
@@ -383,7 +383,7 @@
383
383
  ```
384
384
  :replies: []
385
385
  - :author: Symbroson
386
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06kdig/
386
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06kdig
387
387
  :body: |-
388
388
  141 bytes golfed ruby both parts
389
389
 
@@ -394,7 +394,7 @@
394
394
  ```
395
395
  :replies:
396
396
  - :author: Sharparam
397
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06ta8d/
397
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06ta8d
398
398
  :body: |-
399
399
  134 (not my own just iterating on yours):
400
400
 
@@ -405,7 +405,7 @@
405
405
  ```
406
406
  :replies: []
407
407
  - :author: ni3t
408
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05spvd/
408
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m05spvd
409
409
  :body: |-
410
410
  ```ruby
411
411
  r1 = 0
@@ -428,7 +428,7 @@
428
428
  ```
429
429
  :replies: []
430
430
  - :author: The_Jare
431
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m060zrl/
431
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m060zrl
432
432
  :body: |-
433
433
  ```ruby
434
434
  input = ARGF.read
@@ -447,7 +447,7 @@
447
447
  ```
448
448
  :replies: []
449
449
  - :author: progdog1
450
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m066jzs/
450
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m066jzs
451
451
  :body: |-
452
452
  First time I've ever had to use the flipflop operator.
453
453
 
@@ -464,14 +464,14 @@
464
464
  ```
465
465
  :replies: []
466
466
  - :author: careyi4
467
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06gk6i/
467
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06gk6i
468
468
  :body: |-
469
469
  Well, regex for the win I guess!
470
470
 
471
471
  [https://github.com/careyi3/aoc\_2024/tree/master/solutions/3](https://github.com/careyi3/aoc_2024/tree/master/solutions/3)
472
472
  :replies: []
473
473
  - :author: zaniwoop
474
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06i5in/
474
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06i5in
475
475
  :body: |-
476
476
  ```ruby
477
477
  input = File.read("day_3_data.txt")
@@ -509,7 +509,7 @@
509
509
  ```
510
510
  :replies: []
511
511
  - :author: XtremeNolaner
512
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m07vrch/
512
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m07vrch
513
513
  :body: |-
514
514
  Going for maximum readability with Ruby
515
515
 
@@ -538,7 +538,7 @@
538
538
  ```
539
539
  :replies: []
540
540
  - :author: clonewolf
541
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m095gvz/
541
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m095gvz
542
542
  :body: |-
543
543
  ```ruby
544
544
  module Advent
@@ -594,11 +594,11 @@
594
594
  ```
595
595
  :replies: []
596
596
  - :author: adherry
597
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06rlpk/
597
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m06rlpk
598
598
  :body: I was prepared for a trick and them using a 4 digit number to make the mul invalid, but they did not, so i could have replaced the \d{1,3} with a simple \d+. [paste](https://topaz.github.io/paste/#XQAAAQCEAgAAAAAAAAA0m4poOBLJ+DFPUO+aZQGPHZhaFUucypWoKq40s+q2fAw1o4NFfhSc0+/30SigzZyPEQKlu39h3xDuaHCLSdtd9DyAnZaPiVmFJbFweKI+8NxsykPRnrndEmrMMvTx0OgDdn8pAurca1R4h2kYFyf4XITN0P5phES9Ez0PBxTrN8VW78XAVR1cB+Klhfan3gBSRcZEDe/eRKpiuC7WEvTxi9zEvIK0B4lH1VB4WosHOyOu9C63wJmWs7h8uR1hmiqInG1+Q20RiduwP4DXgn5/XK2uP3agGQFYPxDLGFqusKS3a0Rirx66y7NwKT5Mwr12jGX1kKgex7PClha47L8pv49EgCJGuwWURLk62pRdq7aS2A5LDhTbRJLE+ftkhRgHEclR+cGw71fRRXTnQ6PfIFgPNJAdoXHon2tnyHo/hzqWD+lw2O0ELzRiho+H8FHN0nVv2k3bT6FlX+mfmwUTh3JWWf/s4hYG)
599
599
  :replies: []
600
600
  - :author: Utsav-2
601
- :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m09orf8/
601
+ :url: https://www.reddit.com/r/adventofcode/comments/1h5frsp/2024_day_3_solutions/m09orf8
602
602
  :body: |-
603
603
  Solution using RegEx.
604
604
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  - :author: '442401'
3
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0h3vio/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0h3vio
4
4
  :body: |-
5
5
  Part 1, Transposing and slanting to scan 4 ways
6
6
 
@@ -11,7 +11,7 @@
11
11
  [edit: Extracted another lambda, because who doesn't love lambdas?]
12
12
  :replies: []
13
13
  - :author: el_daniero
14
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0g5ote/
14
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0g5ote
15
15
  :body: |-
16
16
  ```ruby
17
17
  input = File
@@ -49,15 +49,15 @@
49
49
  ```
50
50
  :replies:
51
51
  - :author: minikomi
52
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0giiu6/
52
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0giiu6
53
53
  :body: Very clean!
54
54
  :replies: []
55
55
  - :author: Stronbold
56
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0g4w98/
56
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0g4w98
57
57
  :body: "[https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day04.rb](https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day04.rb)"
58
58
  :replies: []
59
59
  - :author: globalreset
60
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0c086a/
60
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0c086a
61
61
  :body: |-
62
62
  Happy with my solution for part 2. I think this is about as tight as I can get it.
63
63
 
@@ -76,7 +76,7 @@
76
76
  ```
77
77
  :replies: []
78
78
  - :author: Symbroson
79
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0c84rt/
79
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0c84rt
80
80
  :body: |-
81
81
  part 1 golfed: 157 bytes
82
82
 
@@ -95,21 +95,21 @@
95
95
  ```
96
96
  :replies:
97
97
  - :author: '442401'
98
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0h5ews/
98
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0h5ews
99
99
  :body: |-
100
100
  Can you substitute `length` for `size`?
101
101
 
102
102
  That would shave 4 bytes off each.
103
103
  :replies: []
104
104
  - :author: HAEC_EST_SPARTA
105
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0bzj4f/
105
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0bzj4f
106
106
  :body: |-
107
107
  [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2024-ruby/item/lib/day04.rb)
108
108
 
109
109
  I'm fairly pleased with how concise this solution ended up being: it's fairly brute-force, but the expression of the core parameters for both searches in just two lines of code is quite satisfying :)
110
110
  :replies: []
111
111
  - :author: riffraff
112
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0brrii/
112
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0brrii
113
113
  :body: |-
114
114
  happy I keep a Grid class around, I've typoed a 9-sized square too many times. I wasted a lot of time in part 2 since I didn't draw the right squares tho
115
115
 
@@ -164,7 +164,7 @@
164
164
  ```
165
165
  :replies: []
166
166
  - :author: masterarms
167
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0c8udf/
167
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0c8udf
168
168
  :body: |-
169
169
  After trying for some time to get something working with array transposition and skewing I went for the KISS approach:
170
170
 
@@ -216,14 +216,14 @@
216
216
  ```
217
217
  :replies: []
218
218
  - :author: careyi4
219
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0cle3b/
219
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0cle3b
220
220
  :body: |-
221
221
  Easier part 2 than part 1, how odd!
222
222
 
223
223
  [https://github.com/careyi3/aoc\_2024/tree/master/solutions/4](https://github.com/careyi3/aoc_2024/tree/master/solutions/4)
224
224
  :replies: []
225
225
  - :author: FCBStar-of-the-South
226
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0dswek/
226
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0dswek
227
227
  :body: |-
228
228
  Absolutely nothing fancy after getting bit by trying to do day 2 in O(n). I have a feeling that we will use this Grid class again
229
229
 
@@ -232,14 +232,14 @@
232
232
  I am becoming a fan
233
233
  :replies: []
234
234
  - :author: clonewolf
235
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0e9gr2/
235
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0e9gr2
236
236
  :body: |-
237
237
  Part 2: Detect all diagonal "MAS"s, then find how many "A"s overlap
238
238
 
239
239
  [https://github.com/christopher-b/advent-of-code/blob/main/lib/advent/year2024/day04.rb](https://github.com/christopher-b/advent-of-code/blob/main/lib/advent/year2024/day04.rb)
240
240
  :replies: []
241
241
  - :author: The_Jare
242
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0ekpzj/
242
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0ekpzj
243
243
  :body: |-
244
244
  ```ruby
245
245
  $input = ARGF.each.to_a
@@ -272,7 +272,7 @@
272
272
  ```
273
273
  :replies: []
274
274
  - :author: _tfa
275
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0ep1gh/
275
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0ep1gh
276
276
  :body: |-
277
277
  Part 1
278
278
 
@@ -324,11 +324,11 @@
324
324
  ```
325
325
  :replies:
326
326
  - :author: Ill_Information_9522
327
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0eqn1b/
327
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0eqn1b
328
328
  :body: Wow nice. I just finished my Ruby solutions and they're way longer. I just started learning Ruby a week or so ago. Would you mind explaining your code here, for educational purposes? Thanks!
329
329
  :replies:
330
330
  - :author: _tfa
331
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0f05g0/
331
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0f05g0
332
332
  :body: |-
333
333
  Thank you! Sure I can try to explain.
334
334
 
@@ -341,6 +341,6 @@
341
341
  Hope this helps.
342
342
  :replies:
343
343
  - :author: Ill_Information_9522
344
- :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0p5vuq/
344
+ :url: https://www.reddit.com/r/adventofcode/comments/1h689qf/2024_day_4_solutions/m0p5vuq
345
345
  :body: Great, thanks for that. I'm going to use complex numbers for other grid problems and see how they work. Nice little trick indeed!
346
346
  :replies: []