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,17 +1,17 @@
1
1
  ---
2
2
  - :author: '442401'
3
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0my8nw/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0my8nw
4
4
  :body: |-
5
5
  This was a fun one, implementing a custom sort algorithm. I have no idea what type of sort I created, or what the Big O notation might be, but it works and seems to be fairly performant.
6
6
 
7
7
  [pastie](https://topaz.github.io/paste/#XQAAAQBcBAAAAAAAAAARiEJHiiMzw3cPM/1Vl+2nyBa63n8Kw3D1UZFlD3WW8r2Z9pYT30X7PldGU70XB3egANSDGaglT19UFgzZK2FcUaGiOj2QwDkRsdSI8VlTlRHSx96rEK2fgYkMopVYMKvFrxYEOtlpraQtqXI869FkwIsNbKnv6kcagyhdLWfX1FrLl8cJPgtkQe8xLG+avOac7tsm2wzZjJAichGLIJe9pTdisr1vtXsU3qY0B+qxOP04rSWBTWOsIUzYidqufpLIMbHSc2mRiKVRtfOPytmcjdxuNZ88HGUtQYhQj5oRfApkIikmSc7LwHkj+/qxyQ/14ilCVT1UA+dggc1BlIiGBMDdiyKElBXCnuPhwhZnHZ4ydwmaw0i0QafjZcAQiq8KsDn+SSZLxk3cL1AS5MkB8D+vl96hAPL1U8Q4cZVmMA/0hp4tZOrPZrdm6H1jpMMPLFq4MR5QxHAEgv+AG8Q+uPPtIoba+uvxlwXQyuEEUWUudm3ee1Xfvsj5vOZVA/YVg8F1LwpawkD46eKBV8A2at6zmXymUBhK3JhHhAQIb2drHe61bY5XIkjxHzKoS4SSjWwlExFQ7Z05kxWy3WsxazIE7ID/mP6iVSLUE1kMpUhcd1I8oidpQBtSBHCSEXRhC8c2+F8spS5DlP0//yr/1AA=)
8
8
  :replies:
9
9
  - :author: nullset_2
10
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0t597s/
10
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0t597s
11
11
  :body: "+1 for ruby \\<3"
12
12
  :replies: []
13
13
  - :author: Sharparam
14
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0hz686/
14
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0hz686
15
15
  :body: |-
16
16
  ```ruby
17
17
  orderings, updates = ARGF.read.split "\n\n"
@@ -40,7 +40,7 @@
40
40
  Part 2 was quite easy by just using the rules in a custom comparator for the `sort` method.
41
41
  :replies: []
42
42
  - :author: riffraff
43
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i076g/
43
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i076g
44
44
  :body: |-
45
45
  3324/5754
46
46
 
@@ -49,11 +49,11 @@
49
49
  [https://gist.github.com/riffraff/70e9feca5b8d3c236557a7e0796268db](https://gist.github.com/riffraff/70e9feca5b8d3c236557a7e0796268db)
50
50
  :replies:
51
51
  - :author: musifter
52
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0iepv5/
52
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0iepv5
53
53
  :body: Don't worry about not using a topological sort. The input is not a DAG, it has loops. There is no complete sort of the pages, only subsets of them.
54
54
  :replies: []
55
55
  - :author: el_daniero
56
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kiv0k/
56
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kiv0k
57
57
  :body: |-
58
58
  Had a hunch about this one. Felt pretty good when on part 2 I just had to change a `.filter` into a `.partition` and the rest just fell in place by itself :)
59
59
 
@@ -85,21 +85,21 @@
85
85
  ([part 2 diff](https://github.com/daniero/code-challenges/commit/6923d035a911359c626333c75bae423c28d0c553))
86
86
  :replies:
87
87
  - :author: TailorSubstantial863
88
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kylv4/
88
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kylv4
89
89
  :body: |-
90
90
  I'm pretty sure my code does the exact same thing as yours (algorithmically speaking) but it takes 83 lines.
91
91
 
92
92
  nicely done. I'm gonna have to put your code in debug mode to figure it out I think.
93
93
  :replies: []
94
94
  - :author: gosshedd
95
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0iagt3/
95
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0iagt3
96
96
  :body: |-
97
97
  Using the spaceship operator makes both parts equally simple.
98
98
 
99
99
  [Gist](https://gist.github.com/gmitrev/47b0498c2bd403589cd866b2b077689a)
100
100
  :replies: []
101
101
  - :author: _tfa
102
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0ihywy/
102
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0ihywy
103
103
  :body: |-
104
104
  Part 1
105
105
 
@@ -132,18 +132,18 @@
132
132
  ```
133
133
  :replies:
134
134
  - :author: Ill_Information_9522
135
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0lng6f/
135
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0lng6f
136
136
  :body: Enjoying following along with your solutions after solving them myself with my beginner's grasp of Ruby. Thanks for sharing.
137
137
  :replies: []
138
138
  - :author: FCBStar-of-the-South
139
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0k2hny/
139
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0k2hny
140
140
  :body: |-
141
141
  [paste](https://topaz.github.io/paste/#XQAAAQA0AwAAAAAAAAA5GUqKNoFH6SMqoVC09YUYn9dyScIBDNYTI4hnvKYWXrPwLsHeHO6l2A0mcRl8Ns3HhQylr3Khfz4JY3+czGhZ93QRGZ/H13DAhWFK7sa7Zv6wWS5++4B4VBZWS5ooiS9de/AlbgI7SjS9heaT2QZnwnZj8giLuaos879X3tI0OJIAogzVUHsgYA0ss0NCeSeaaYRd5dTDriXvXcR0BJQhPeX656k0aWJc79qLHua5fmyFZlpkgrmWHeyQcwm2HzboaMyI/PkhtftOcshzo6ZF1Fn7BRPLa0yZS+JtnWne3EwZRdofK4WG9fc//SX9tbDPgPzr6nYntRd6tKj6WoQNGbtVnOEMA2gKAm4nkVd5SxafWvtFGYpqVBu+r5l6ZIef8H3S7eXUz8qMynQtLBemtp5tY8OnRd6NYf6pRe5XfCBYuuihZxi63r2bpv7S2qR0C/ZenWzHdeCYwMvvEg8M2GwIASjVE1KXXIh38dhsMemXkqdBaX1CUWqSYebyBGT9zhDtieKKnpdIk/18Tf3qLsMSzff/tJCSSw==)
142
142
 
143
143
  Very interesting problem that is actually quite educational about binary relation and total ordering. Might write up a tutorial post later as a review for myself as well ([done!](https://www.reddit.com/r/adventofcode/comments/1h7mm3w/2024_day_05_part_2_how_nice_is_the_input_a_binary))
144
144
  :replies: []
145
145
  - :author: Symbroson
146
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kvznz/
146
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kvznz
147
147
  :body: |-
148
148
  both parts, quick and easy:
149
149
 
@@ -169,7 +169,7 @@
169
169
  ```
170
170
  :replies: []
171
171
  - :author: The_Jare
172
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0l9y1s/
172
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0l9y1s
173
173
  :body: |-
174
174
  ```ruby
175
175
  rules, reports = ARGF.map(&:strip).reject(&:empty?).partition { | l | l.index("|") }
@@ -196,32 +196,32 @@
196
196
  ```
197
197
  :replies: []
198
198
  - :author: HAEC_EST_SPARTA
199
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i5hkk/
199
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i5hkk
200
200
  :body: |-
201
201
  [Solution on sourcehut](https://git.sr.ht/%7Eawsmith/advent-of-code/tree/2024-ruby/item/lib/day05.rb)
202
202
 
203
203
  I wasted a significant amount of time implementing a topological sort of the ordering constraints, just to discover that my input had cycles, so that sort wasn't really possible. After that, I implemented the non-graph solution above. Notable features are the reversal of the updates in `unordered?`, which allows me to check whether any ordering constraint is violated without having to iterate through the constraints, and the usage of an insertion-sort-style first-fit allocation algorithm for pages in Part 2 to perform the allocation of each page in linear time.
204
204
  :replies:
205
205
  - :author: Eilip999
206
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i6mgo/
206
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i6mgo
207
207
  :body: |-
208
208
  It should not be possible for cycles in input to happen, if it was a case you wouldn't be able to sort it even with your algorithm which is not based on graph.
209
209
 
210
210
  Edit, Okay it might be possible to have cycle in rules, but then cycle should not be visible in list of pages, so like, you have the edges, but vertices are missing so these edges should not be included in the graph.
211
211
  :replies:
212
212
  - :author: HAEC_EST_SPARTA
213
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i7zul/
213
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i7zul
214
214
  :body: Right, the global set of ordering constraints does contain cycles, although if you pare it down to only the pages contained in each update, then that is no longer the case. I realised that a bit too late, but _c'est la vie_.
215
215
  :replies: []
216
216
  - :author: globalreset
217
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i6xkn/
217
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0i6xkn
218
218
  :body: |-
219
219
  I initially wasted time creating "before rules" and "after rules" for part 2, thinking I would need the reverse map to 'squeeze' a value in to the right place. But saw through testing after I was done that it was pointless. I wish I would've thought of the 'sort' method though as that's a clean result.
220
220
 
221
221
  [github - solution](https://github.com/globalreset/advent_of_code/blob/main/challenges/2024/05/solution.rb)
222
222
  :replies: []
223
223
  - :author: im_sofi
224
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0ix512/
224
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0ix512
225
225
  :body: |-
226
226
  Interesting day. Worked a bit on my `std++` library and added a `Enumerable#partitions` function to allow a partitioned scan of `|left, current, right|` over the elements so i could handle the rules being defined as `before` and `after`.
227
227
 
@@ -230,7 +230,7 @@
230
230
  https://github.com/soupglasses/advent-of-code/blob/main/2024/ruby/day\_05.rb
231
231
  :replies: []
232
232
  - :author: Independent_Top_8716
233
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0iy7eq/
233
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0iy7eq
234
234
  :body: |-
235
235
  After (not unexpectedly) realizing that a recursive or permutations based approach would not scale for part2 I used a hinted approach for part 2
236
236
 
@@ -292,30 +292,30 @@
292
292
  ```
293
293
  :replies: []
294
294
  - :author: careyi4
295
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0j6f41/
295
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0j6f41
296
296
  :body: |-
297
297
  It wasn't immediately obvious to me that implementing a ruby sort function would just work here, but it seems there is only one validly sorted order for the string based on the rules, making this leap confirmed the solution to me.
298
298
 
299
299
  [https://github.com/careyi3/aoc\_2024/tree/master/solutions/5](https://github.com/careyi3/aoc_2024/tree/master/solutions/5)
300
300
  :replies:
301
301
  - :author: FCBStar-of-the-South
302
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0jtl71/
302
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0jtl71
303
303
  :body: I did not want to implement sorting because there is not any guarantee that the | relation is transitive but apparently it is
304
304
  :replies:
305
305
  - :author: careyi4
306
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0k1hjd/
306
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0k1hjd
307
307
  :body: Yeah, same, it didn't feel like it should work, but when I tried it and it did work I was surprised. I felt like there surely should be multiple orders that satisified the rules, apparently not per the rules.
308
308
  :replies:
309
309
  - :author: FCBStar-of-the-South
310
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0k23ww/
310
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0k23ww
311
311
  :body: I was probably reading between the lines too closely haha. The example explicitly checked the ordering between every pair instead of just the adjacent pairs and I thought that's a sign the relation might not be transitive
312
312
  :replies: []
313
313
  - :author: Stronbold
314
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0j9e9o/
314
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0j9e9o
315
315
  :body: "[Solution](https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day05.rb)"
316
316
  :replies: []
317
317
  - :author: masterarms
318
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0jm95n/
318
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0jm95n
319
319
  :body: |-
320
320
  Part 2 took me quite some time before realizing a sort would work.
321
321
 
@@ -361,7 +361,7 @@
361
361
  ```
362
362
  :replies: []
363
363
  - :author: fredster231
364
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0jploy/
364
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0jploy
365
365
  :body: |-
366
366
  ```ruby
367
367
  rules, updates = File.readlines('005.input')
@@ -388,14 +388,14 @@
388
388
  ```
389
389
  :replies: []
390
390
  - :author: clonewolf
391
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kh6du/
391
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kh6du
392
392
  :body: |-
393
393
  Unable to do a TSort on the whole set, I'm doing TSorts on each subset of the graph defined by each update.
394
394
 
395
395
  [https://github.com/christopher-b/advent-of-code/blob/main/lib/advent/year2024/day05.rb](https://github.com/christopher-b/advent-of-code/blob/main/lib/advent/year2024/day05.rb)
396
396
  :replies: []
397
397
  - :author: sigmazero13
398
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kl2i7/
398
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kl2i7
399
399
  :body: |-
400
400
  Parts 1 and 2 together.
401
401
 
@@ -404,7 +404,7 @@
404
404
  Basically, just created a Page class with methods to allow for custom sorting using the rules. From there, finding the valid updates (and fixing the invalid ones) was a piece of cake.
405
405
  :replies:
406
406
  - :author: rcraggs
407
- :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kpg4l/
407
+ :url: https://www.reddit.com/r/adventofcode/comments/1h71eyz/2024_day_5_solutions/m0kpg4l
408
408
  :body: |-
409
409
  I did the same thing in Python. No idea about efficiency but it makes for really tidy code and a simple idea
410
410
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  - :author: tycoon177
3
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0xo9lk/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0xo9lk
4
4
  :body: |-
5
5
  [Part 1 and 2](https://github.com/BenMcH/advent-of-code/blob/df8325ce8e633e307b599a8e367537351c993e8b/2024/lib/day_06.rb)
6
6
 
@@ -9,7 +9,7 @@
9
9
  By re-using that previous state in this manner, I was able to shave this solution down to 1.5 seconds with ease. I'm sure I could further optimize, but I'm happy at this point.
10
10
  :replies: []
11
11
  - :author: _tfa
12
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pdsmr/
12
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pdsmr
13
13
  :body: |-
14
14
  Just brute force today...
15
15
 
@@ -18,62 +18,62 @@
18
18
  Edit: Optimized my solution a bit, but still takes ~17 sec for part 2.
19
19
  :replies:
20
20
  - :author: quokka70
21
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0qlk97/
21
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0qlk97
22
22
  :body: Using a Set for @grid instead of an array will make `grid.include?` faster (unless the hashing overhead is too much).
23
23
  :replies:
24
24
  - :author: _tfa
25
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0uf1wc/
25
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0uf1wc
26
26
  :body: You are right. That was the optimization I did after I sent the code to pastebin (couldn't edit it there)
27
27
  :replies: []
28
28
  - :author: careyi4
29
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0q4x8j/
29
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0q4x8j
30
30
  :body: |-
31
31
  Biggest thing that tripped me up was I was failing to recheck if I was facing another wall after rotating. A litreal one word change from an if statement to a while loop fix it for me.
32
32
 
33
33
  [https://github.com/careyi3/aoc\_2024/tree/master/solutions/6](https://github.com/careyi3/aoc_2024/tree/master/solutions/6)
34
34
  :replies:
35
35
  - :author: globalreset
36
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0qdjv8/
36
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0qdjv8
37
37
  :body: Same!
38
38
  :replies: []
39
39
  - :author: nothimofc
40
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0ny6iz/
40
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0ny6iz
41
41
  :body: |-
42
42
  While Part 1 (counting distinct positions visited) works relatively fast, Part 2 (finding loop-causing obstacle positions) is extremely slow for large grids.
43
43
 
44
44
  [github](https://github.com/osu/advent-of-code/blob/main/day6/joe.rb)
45
45
  :replies:
46
46
  - :author: nothimofc
47
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0nywg2/
47
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0nywg2
48
48
  :body: I would appreciate any advice from fellow ruby enjoyers I could have gotten a much better placement than 70/10 :( if it was faster.
49
49
  :replies:
50
50
  - :author: Lucky_Menu3724
51
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0o4twa/
51
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0o4twa
52
52
  :body: |-
53
53
  Here is what I did. I tested your code and mine was about twice as fast, but it took me a lot longer than you to write :) 18s to run on an old laptop.
54
54
 
55
55
  [https://gist.github.com/imme5150/d51ab9746902aa1e2609bc7d1cbb3866](https://gist.github.com/imme5150/d51ab9746902aa1e2609bc7d1cbb3866)
56
56
  :replies:
57
57
  - :author: nothimofc
58
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0o6704/
58
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0o6704
59
59
  :body: Sheesh nice
60
60
  :replies: []
61
61
  - :author: globalreset
62
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0o89vy/
62
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0o89vy
63
63
  :body: |-
64
64
  Got stuck for an hour on part 2 before realizing that the obstacle created a situation where you could turn away from a wall to find another wall. Tricky since I got away without handling that case in part 1. Seems like the input was constructed just to allow that mistake on part 1 and kill me on part 2. Just a matter of changing "if(grid[nextPos]=='#' || nextPos==obstructedPos)" into "while(...)".
65
65
 
66
66
  [github - solution](https://github.com/globalreset/advent_of_code/blob/main/challenges/2024/06/solution.rb)
67
67
  :replies: []
68
68
  - :author: akanet
69
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0oma65/
69
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0oma65
70
70
  :body: |-
71
71
  [https://gist.github.com/vincentwoo/bff280de0b1fb16d4e511d85c339879a](https://gist.github.com/vincentwoo/bff280de0b1fb16d4e511d85c339879a)
72
72
 
73
73
  Was pleased enough to find a formulation that uses the same code for both initially running through the maze as well as splitting off to see if each next step's hypothetical obstacle would generate a loop. Sharing the in-progress seen list saves quite a bit of time. 35 lines and about 2s runtime.
74
74
  :replies: []
75
75
  - :author: masterarms
76
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0ot8pg/
76
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0ot8pg
77
77
  :body: |-
78
78
  It was quickly obvious that trying a block on every empty grid position would not scale. But with 2 optimisations the runtime was tolerable.
79
79
 
@@ -134,7 +134,7 @@
134
134
  ```
135
135
  :replies:
136
136
  - :author: masterarms
137
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pa90y/
137
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pa90y
138
138
  :body: |-
139
139
  I was not too happy with the rotation and moving logic, so I made a second version using Complex numbers as the coordinates. In that case a movement is simply an addition and a rotation of the direction a multiplication by `Complex::I`.
140
140
 
@@ -146,25 +146,25 @@
146
146
  ```
147
147
  :replies: []
148
148
  - :author: Stronbold
149
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pjb4l/
149
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pjb4l
150
150
  :body: |-
151
151
  Brute force solution for part 2, runs in 40s for both parts.
152
152
 
153
153
  [Solution](https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day06.rb)
154
154
  :replies: []
155
155
  - :author: Infinite-Club4374
156
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0podjn/
156
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0podjn
157
157
  :body: "Hey all! I’m having a bit of trouble locating the last edge cases, anyone have any ideas?\n\nWith my custom input my solution gives 1573 but should be 1686. Would really appreciate any insights or help \U0001F499\n\n[GitHub](https://github.com/Leftyxiv/advent_of_code/blob/main/2024/day6/day6.rb)"
158
158
  :replies:
159
159
  - :author: ash30342
160
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0prpve/
160
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0prpve
161
161
  :body: I think you missed that when you turn right, you can immediately encounter an obstacle again. You should keep turning until you can move on. That tripped me up :)
162
162
  :replies:
163
163
  - :author: Infinite-Club4374
164
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pse59/
164
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0pse59
165
165
  :body: "You just saved my life!!\n\nI had a check for that initially but I only turned once instead of looping and you gave me the idea to loop until a direction was good!\n\nTHANK YOU SO MUCH INTERNET FRIEND\U0001F499\U0001F499\U0001F499\U0001F499"
166
166
  :replies: []
167
167
  - :author: FCBStar-of-the-South
168
- :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0sbg2g/
168
+ :url: https://www.reddit.com/r/adventofcode/comments/1h7tovg/2024_day_6_solutions/m0sbg2g
169
169
  :body: "[paste](https://topaz.github.io/paste/#XQAAAQA9BwAAAAAAAAA5GUqKNoFH9WVqAtfQAlEIpeJL/pI3jz8l8zNIKbgBcDs8e/u+sq3cCy1X/xTZynv7KRl8RXO1kbXSYEeewqIPU0fRMdhsu3XI1mrs7eplcKLDUV5gsYYjnL57KBqLKkESiAilkCA2oAYk88/KK9PDxx8gLQ8UR3fan3QjqEMmpkVn9gsXhcp76M+iRq5JO7RtciTlNresld3ohY6cDF4LkORgw1x+6070yQMPm6H73KV3/ZqetWgQsuoQGbRsIZKIJ1g1dF7+lXRk/Q2acJ9bjkLkBoB2nI3LIzyhJWhDRZaF6AITEktez3wabyinxaV6WxtS5DgefV7XzSVjD62J8lnwOs5/8bT/Q3pjLeHBqDNq7ygcMtuTRzO6H1fiVfovOq06jEFwuCgmFJc+T7+Qs9Vx+t/ah2QhVWBTg2OKP95QrtbtEgyWf/zZIm+JnGb6Mpy2tkr+Mb9JVC2GqlVwofAR9yWURwil94aW8EN4nyO7IvbCU9e2jbmqzPcw9w5wkytEmOuI++GC7i7vYkZoJwSFaIy/kv2gUO8vtmqt3jdlizWjXdV1bmq/AZtPYMl5ZRpFqYkL6G5I25oEX5bV5IzYQGz857jPbLPjhTMjmNYvZO5jr88co3qhPc3UzVPFw0zjL5C1sSn1OTDk2LnWetfwvu6BoQ5+X6R+JuEdMP/256fHSruPzd3ZURw2rZg3gzuqBPgVcHyLXQlqy0TsWJm8Sq5qwFHqcAiceCHzDIBAkq28j8mkO05HJz9pOoRTDqrkdQeyWKqVYnP9HKsC4/qf8+3KG8HVgka6pSgOSgFZ4PdcYB+IH+2z3v179uN2/uc2AGp7L/31Ylg=)"
170
170
  :replies: []
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  - :author: RazarTuk
3
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ynz5p/
3
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ynz5p
4
4
  :body: |-
5
5
  These isn't enough Ruby on this subreddit, so I may as well start posting _my_ solutions. Also, this is very intentionally only part _1_, in case anyone reading wants to practice by extending it for part 2. And I know it would probably be easier to just tokenize each line as I'm reading them in, but I'm using that first line as boilerplate so I don't have to think about input.
6
6
 
@@ -32,7 +32,7 @@
32
32
  EDIT: Oh, and it executes in ~100ms
33
33
  :replies: []
34
34
  - :author: SwagosaurusFlex
35
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0u8enb/
35
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0u8enb
36
36
  :body: |-
37
37
  I'm having trouble figuring out why my solution isn't passing for Part 2. It works on Part 1 and the example case, but it's giving too high of an answer on Part 2. Any help appreciated, thanks
38
38
 
@@ -73,19 +73,19 @@
73
73
  ```
74
74
  :replies:
75
75
  - :author: thereal_peasant
76
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0uabou/
76
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0uabou
77
77
  :body: 'What happens when your `runningTotal` is equal to the `total` but there are still numbers left in `parts`? For example, take the input `''100: 10 10 3''`. Does this return `true`? Should it?'
78
78
  :replies:
79
79
  - :author: SwagosaurusFlex
80
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ucr4t/
80
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ucr4t
81
81
  :body: Ah that makes sense, can't believe I missed that! Thanks, finally got the star
82
82
  :replies: []
83
83
  - :author: ASteelyDan
84
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0uf841/
84
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0uf841
85
85
  :body: Ah, had the same problem, thank you!
86
86
  :replies: []
87
87
  - :author: NullT3rminated
88
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tr6lg/
88
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tr6lg
89
89
  :body: |-
90
90
  970/553
91
91
 
@@ -94,22 +94,22 @@
94
94
  First time getting top 1000, which is exciting for me! Definitely not the fastest solution though.
95
95
  :replies:
96
96
  - :author: FCBStar-of-the-South
97
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ttgnx/
97
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ttgnx
98
98
  :body: |-
99
99
  Oh and I was excited to be the first Ruby in the megathread haha
100
100
 
101
101
  What is your runtime like? I only started learning ruby by doing AoC this year so I will really appreciate it if you can give me some feedback on my solution!
102
102
  :replies:
103
103
  - :author: NullT3rminated
104
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tuf38/
104
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tuf38
105
105
  :body: I get about 3 seconds on my laptop. Just slow enough to make me start to worry and start thinking about optimizations before it completed. YJIT speeds it up by about 300ms.
106
106
  :replies:
107
107
  - :author: FCBStar-of-the-South
108
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tv98q/
108
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tv98q
109
109
  :body: I think the only difference between our implementation is how we do ||. You use string concatenation and I use the logarithm. Will have to benchmark your way tmr
110
110
  :replies:
111
111
  - :author: NullT3rminated
112
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0u8m8s/
112
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0u8m8s
113
113
  :body: |-
114
114
  Ok I changed mine to use log10 instead of string concatenation, and I went from 2.781s with YJIT to 1.549s with YJIT, so log is definitely faster.
115
115
 
@@ -132,7 +132,7 @@
132
132
  ```
133
133
  :replies: []
134
134
  - :author: yourparadigm
135
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tyk8p/
135
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tyk8p
136
136
  :body: |-
137
137
  [LANGUAGE: Go]
138
138
 
@@ -143,7 +143,7 @@
143
143
  [Ruby Solution](https://github.com/phene/advent-of-code/blob/main/2024/07/7.rb) runs in about 2s and [Go Solution](https://github.com/phene/advent-of-code/blob/main/2024/07/7.go) runs in 1s.
144
144
  :replies: []
145
145
  - :author: _tfa
146
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0uc4nt/
146
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0uc4nt
147
147
  :body: |-
148
148
  Part 1
149
149
 
@@ -176,18 +176,18 @@
176
176
  ```
177
177
  :replies:
178
178
  - :author: Ill_Information_9522
179
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m1b2e92/
179
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m1b2e92
180
180
  :body: This is great... very idiomatic. Still learning-- hadn't though of adding a bar operator to Integer. Love the built-in permutation methods though, quite handy. Not sure if other languages have such powerful stdlibs.
181
181
  :replies: []
182
182
  - :author: fredster231
183
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0vh0np/
183
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0vh0np
184
184
  :body: |-
185
185
  10 seconds lol, fun anonymous recursive pattern tho
186
186
 
187
187
  https://gist.github.com/scockram/3ce5efc10cad27bf08c78bca4bcffd5f
188
188
  :replies: []
189
189
  - :author: careyi4
190
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0vm2bo/
190
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0vm2bo
191
191
  :body: |-
192
192
  Tight on time today, brute force did the job!
193
193
 
@@ -196,7 +196,7 @@
196
196
  [https://github.com/careyi3/aoc\_2024/tree/master/solutions/7](https://github.com/careyi3/aoc_2024/tree/master/solutions/7)
197
197
  :replies: []
198
198
  - :author: FCBStar-of-the-South
199
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tt4k6/
199
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tt4k6
200
200
  :body: |-
201
201
  ```ruby
202
202
  require_relative 'utils'
@@ -240,15 +240,15 @@
240
240
  Edit: not using a set cuts this down to barely a second
241
241
  :replies:
242
242
  - :author: yourparadigm
243
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0u05oy/
243
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0u05oy
244
244
  :body: You'd save a lot of time and memory by not saving all the possible results.
245
245
  :replies:
246
246
  - :author: FCBStar-of-the-South
247
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0xtael/
247
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0xtael
248
248
  :body: Eh this morning I just said what if I don’t do any deduplication with sets. Cut it right down to barely over a second and that’s good enough for me
249
249
  :replies: []
250
250
  - :author: riffraff
251
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ttkxm/
251
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0ttkxm
252
252
  :body: |-
253
253
  today was ... easy? I wasted some time on part 1 cause I tried to build the result down by subtracting and dividing instead of building it up, which didn't work. Also on part two I thought brute force would take a while, but turned out I was brute forcing \*the whole input as a single line\* which, well, didn't go anywhere.
254
254
 
@@ -283,11 +283,11 @@
283
283
  ```
284
284
  :replies:
285
285
  - :author: phord
286
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tuz30/
286
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0tuz30
287
287
  :body: It never occurred to me to optimize by stopping when I exceed the target. But it ran so fast from the start, I obviously didn't need to.
288
288
  :replies: []
289
289
  - :author: masterarms
290
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0usl5m/
290
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0usl5m
291
291
  :body: |-
292
292
  Not the weekend day I feared :)
293
293
 
@@ -323,7 +323,7 @@
323
323
  ```
324
324
  :replies:
325
325
  - :author: masterarms
326
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0w9n1j/
326
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0w9n1j
327
327
  :body: |-
328
328
  Going from right to left is _much_ faster.
329
329
 
@@ -367,7 +367,7 @@
367
367
  ```
368
368
  :replies: []
369
369
  - :author: el_daniero
370
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0v417f/
370
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0v417f
371
371
  :body: |-
372
372
  I could smell the Dynamic Programming from far away, but this is the first time I've realized that I don't have to build up that whole double array to keep track of everything. Probably also the first time I wrote a nested `reduce` like that.
373
373
 
@@ -396,7 +396,7 @@
396
396
  ```
397
397
  :replies:
398
398
  - :author: el_daniero
399
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0v9d0d/
399
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0v9d0d
400
400
  :body: |-
401
401
  And a brute force solution for good measure
402
402
 
@@ -419,11 +419,11 @@
419
419
  ```
420
420
  :replies: []
421
421
  - :author: Stronbold
422
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0v7ys7/
422
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0v7ys7
423
423
  :body: "[Solution](https://github.com/Alvaro-Kothe/Advent-of-Code/blob/main/2024/day07.rb)"
424
424
  :replies: []
425
425
  - :author: mpyne
426
- :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0vjiih/
426
+ :url: https://www.reddit.com/r/adventofcode/comments/1h8l3z5/2024_day_7_solutions/m0vjiih
427
427
  :body: |-
428
428
  I was doing my solutions in Rust this year, but Ruby has an iterator operator that is more or less genetically designed for this problem, `repeated_permutation`, so I wanted to throw it in and test it out.
429
429