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.
- checksums.yaml +4 -4
- data/bin/arb +1 -1
- data/data/solutions/reddit/ruby/2015/02.yml +5 -5
- data/data/solutions/reddit/ruby/2015/03.yml +6 -6
- data/data/solutions/reddit/ruby/2015/04.yml +7 -7
- data/data/solutions/reddit/ruby/2015/05.yml +6 -6
- data/data/solutions/reddit/ruby/2015/06.yml +14 -14
- data/data/solutions/reddit/ruby/2015/07.yml +15 -15
- data/data/solutions/reddit/ruby/2015/08.yml +6 -6
- data/data/solutions/reddit/ruby/2015/09.yml +11 -11
- data/data/solutions/reddit/ruby/2015/10.yml +18 -18
- data/data/solutions/reddit/ruby/2015/11.yml +19 -19
- data/data/solutions/reddit/ruby/2015/12.yml +10 -10
- data/data/solutions/reddit/ruby/2015/13.yml +9 -9
- data/data/solutions/reddit/ruby/2015/14.yml +11 -11
- data/data/solutions/reddit/ruby/2015/15.yml +9 -9
- data/data/solutions/reddit/ruby/2015/16.yml +7 -7
- data/data/solutions/reddit/ruby/2015/17.yml +10 -10
- data/data/solutions/reddit/ruby/2015/18.yml +4 -4
- data/data/solutions/reddit/ruby/2015/19.yml +1 -1
- data/data/solutions/reddit/ruby/2015/20.yml +2 -2
- data/data/solutions/reddit/ruby/2015/21.yml +4 -4
- data/data/solutions/reddit/ruby/2015/22.yml +5 -5
- data/data/solutions/reddit/ruby/2015/23.yml +3 -3
- data/data/solutions/reddit/ruby/2015/24.yml +11 -11
- data/data/solutions/reddit/ruby/2015/25.yml +5 -5
- data/data/solutions/reddit/ruby/2016/01.yml +5 -5
- data/data/solutions/reddit/ruby/2016/02.yml +3 -3
- data/data/solutions/reddit/ruby/2016/03.yml +1 -1
- data/data/solutions/reddit/ruby/2016/04.yml +4 -4
- data/data/solutions/reddit/ruby/2016/05.yml +3 -3
- data/data/solutions/reddit/ruby/2016/06.yml +4 -4
- data/data/solutions/reddit/ruby/2016/07.yml +3 -3
- data/data/solutions/reddit/ruby/2016/08.yml +6 -6
- data/data/solutions/reddit/ruby/2016/09.yml +1 -1
- data/data/solutions/reddit/ruby/2016/10.yml +3 -3
- data/data/solutions/reddit/ruby/2016/11.yml +1 -1
- data/data/solutions/reddit/ruby/2016/12.yml +3 -3
- data/data/solutions/reddit/ruby/2016/14.yml +4 -4
- data/data/solutions/reddit/ruby/2016/15.yml +11 -11
- data/data/solutions/reddit/ruby/2016/16.yml +1 -1
- data/data/solutions/reddit/ruby/2016/17.yml +3 -3
- data/data/solutions/reddit/ruby/2016/18.yml +3 -3
- data/data/solutions/reddit/ruby/2016/20.yml +2 -2
- data/data/solutions/reddit/ruby/2016/21.yml +7 -7
- data/data/solutions/reddit/ruby/2016/22.yml +10 -10
- data/data/solutions/reddit/ruby/2017/01.yml +7 -7
- data/data/solutions/reddit/ruby/2017/02.yml +15 -15
- data/data/solutions/reddit/ruby/2017/03.yml +9 -9
- data/data/solutions/reddit/ruby/2017/04.yml +4 -4
- data/data/solutions/reddit/ruby/2017/05.yml +12 -12
- data/data/solutions/reddit/ruby/2017/06.yml +16 -16
- data/data/solutions/reddit/ruby/2017/07.yml +5 -5
- data/data/solutions/reddit/ruby/2017/08.yml +18 -18
- data/data/solutions/reddit/ruby/2017/09.yml +7 -7
- data/data/solutions/reddit/ruby/2017/10.yml +9 -9
- data/data/solutions/reddit/ruby/2017/11.yml +1 -1
- data/data/solutions/reddit/ruby/2017/12.yml +6 -6
- data/data/solutions/reddit/ruby/2017/13.yml +6 -6
- data/data/solutions/reddit/ruby/2017/14.yml +1 -1
- data/data/solutions/reddit/ruby/2017/15.yml +3 -3
- data/data/solutions/reddit/ruby/2017/16.yml +5 -5
- data/data/solutions/reddit/ruby/2017/17.yml +6 -6
- data/data/solutions/reddit/ruby/2017/18.yml +7 -7
- data/data/solutions/reddit/ruby/2017/19.yml +2 -2
- data/data/solutions/reddit/ruby/2017/20.yml +5 -5
- data/data/solutions/reddit/ruby/2017/21.yml +11 -11
- data/data/solutions/reddit/ruby/2017/22.yml +1 -1
- data/data/solutions/reddit/ruby/2017/23.yml +1 -1
- data/data/solutions/reddit/ruby/2017/25.yml +3 -3
- data/data/solutions/reddit/ruby/2018/01.yml +20 -20
- data/data/solutions/reddit/ruby/2018/02.yml +16 -16
- data/data/solutions/reddit/ruby/2018/03.yml +12 -12
- data/data/solutions/reddit/ruby/2018/04.yml +6 -6
- data/data/solutions/reddit/ruby/2018/05.yml +15 -15
- data/data/solutions/reddit/ruby/2018/06.yml +4 -4
- data/data/solutions/reddit/ruby/2018/07.yml +11 -11
- data/data/solutions/reddit/ruby/2018/08.yml +9 -9
- data/data/solutions/reddit/ruby/2018/09.yml +13 -13
- data/data/solutions/reddit/ruby/2018/10.yml +10 -10
- data/data/solutions/reddit/ruby/2018/11.yml +9 -9
- data/data/solutions/reddit/ruby/2018/12.yml +2 -2
- data/data/solutions/reddit/ruby/2018/13.yml +14 -14
- data/data/solutions/reddit/ruby/2018/14.yml +5 -5
- data/data/solutions/reddit/ruby/2018/15.yml +2 -2
- data/data/solutions/reddit/ruby/2018/16.yml +7 -7
- data/data/solutions/reddit/ruby/2018/17.yml +1 -1
- data/data/solutions/reddit/ruby/2018/18.yml +6 -6
- data/data/solutions/reddit/ruby/2018/19.yml +1 -1
- data/data/solutions/reddit/ruby/2018/20.yml +1 -1
- data/data/solutions/reddit/ruby/2018/21.yml +4 -4
- data/data/solutions/reddit/ruby/2018/22.yml +3 -3
- data/data/solutions/reddit/ruby/2018/23.yml +11 -11
- data/data/solutions/reddit/ruby/2018/24.yml +4 -4
- data/data/solutions/reddit/ruby/2018/25.yml +6 -6
- data/data/solutions/reddit/ruby/2019/01.yml +11 -11
- data/data/solutions/reddit/ruby/2019/02.yml +13 -13
- data/data/solutions/reddit/ruby/2019/03.yml +7 -7
- data/data/solutions/reddit/ruby/2019/04.yml +11 -11
- data/data/solutions/reddit/ruby/2019/05.yml +10 -10
- data/data/solutions/reddit/ruby/2019/06.yml +7 -7
- data/data/solutions/reddit/ruby/2019/07.yml +8 -8
- data/data/solutions/reddit/ruby/2019/08.yml +8 -8
- data/data/solutions/reddit/ruby/2019/09.yml +4 -4
- data/data/solutions/reddit/ruby/2019/10.yml +4 -4
- data/data/solutions/reddit/ruby/2019/11.yml +7 -7
- data/data/solutions/reddit/ruby/2019/12.yml +17 -17
- data/data/solutions/reddit/ruby/2019/13.yml +6 -6
- data/data/solutions/reddit/ruby/2019/14.yml +2 -2
- data/data/solutions/reddit/ruby/2019/15.yml +3 -3
- data/data/solutions/reddit/ruby/2019/16.yml +6 -6
- data/data/solutions/reddit/ruby/2019/17.yml +3 -3
- data/data/solutions/reddit/ruby/2019/18.yml +1 -1
- data/data/solutions/reddit/ruby/2019/20.yml +9 -9
- data/data/solutions/reddit/ruby/2019/21.yml +3 -3
- data/data/solutions/reddit/ruby/2019/22.yml +3 -3
- data/data/solutions/reddit/ruby/2019/23.yml +1 -1
- data/data/solutions/reddit/ruby/2019/25.yml +2 -2
- data/data/solutions/reddit/ruby/2020/01.yml +30 -30
- data/data/solutions/reddit/ruby/2020/02.yml +25 -25
- data/data/solutions/reddit/ruby/2020/03.yml +17 -17
- data/data/solutions/reddit/ruby/2020/04.yml +26 -26
- data/data/solutions/reddit/ruby/2020/05.yml +35 -35
- data/data/solutions/reddit/ruby/2020/06.yml +40 -40
- data/data/solutions/reddit/ruby/2020/07.yml +16 -16
- data/data/solutions/reddit/ruby/2020/08.yml +13 -13
- data/data/solutions/reddit/ruby/2020/09.yml +21 -21
- data/data/solutions/reddit/ruby/2020/10.yml +29 -29
- data/data/solutions/reddit/ruby/2020/11.yml +8 -8
- data/data/solutions/reddit/ruby/2020/12.yml +22 -22
- data/data/solutions/reddit/ruby/2020/13.yml +15 -15
- data/data/solutions/reddit/ruby/2020/14.yml +11 -11
- data/data/solutions/reddit/ruby/2020/15.yml +9 -9
- data/data/solutions/reddit/ruby/2020/16.yml +13 -13
- data/data/solutions/reddit/ruby/2020/17.yml +11 -11
- data/data/solutions/reddit/ruby/2020/18.yml +19 -19
- data/data/solutions/reddit/ruby/2020/19.yml +18 -18
- data/data/solutions/reddit/ruby/2020/20.yml +4 -4
- data/data/solutions/reddit/ruby/2020/21.yml +4 -4
- data/data/solutions/reddit/ruby/2020/22.yml +8 -8
- data/data/solutions/reddit/ruby/2020/23.yml +4 -4
- data/data/solutions/reddit/ruby/2020/24.yml +6 -6
- data/data/solutions/reddit/ruby/2020/25.yml +6 -6
- data/data/solutions/reddit/ruby/2021/01.yml +74 -74
- data/data/solutions/reddit/ruby/2021/02.yml +45 -45
- data/data/solutions/reddit/ruby/2021/03.yml +43 -43
- data/data/solutions/reddit/ruby/2021/04.yml +23 -23
- data/data/solutions/reddit/ruby/2021/05.yml +16 -16
- data/data/solutions/reddit/ruby/2021/06.yml +35 -35
- data/data/solutions/reddit/ruby/2021/07.yml +26 -26
- data/data/solutions/reddit/ruby/2021/08.yml +15 -15
- data/data/solutions/reddit/ruby/2021/09.yml +11 -11
- data/data/solutions/reddit/ruby/2021/10.yml +9 -9
- data/data/solutions/reddit/ruby/2021/11.yml +12 -12
- data/data/solutions/reddit/ruby/2021/12.yml +8 -8
- data/data/solutions/reddit/ruby/2021/13.yml +13 -13
- data/data/solutions/reddit/ruby/2021/14.yml +10 -10
- data/data/solutions/reddit/ruby/2021/15.yml +10 -10
- data/data/solutions/reddit/ruby/2021/16.yml +8 -8
- data/data/solutions/reddit/ruby/2021/17.yml +6 -6
- data/data/solutions/reddit/ruby/2021/18.yml +5 -5
- data/data/solutions/reddit/ruby/2021/19.yml +3 -3
- data/data/solutions/reddit/ruby/2021/20.yml +5 -5
- data/data/solutions/reddit/ruby/2021/21.yml +5 -5
- data/data/solutions/reddit/ruby/2021/22.yml +4 -4
- data/data/solutions/reddit/ruby/2021/23.yml +7 -7
- data/data/solutions/reddit/ruby/2021/24.yml +8 -8
- data/data/solutions/reddit/ruby/2021/25.yml +4 -4
- data/data/solutions/reddit/ruby/2022/01.yml +29 -29
- data/data/solutions/reddit/ruby/2022/02.yml +21 -21
- data/data/solutions/reddit/ruby/2022/03.yml +35 -35
- data/data/solutions/reddit/ruby/2022/04.yml +42 -42
- data/data/solutions/reddit/ruby/2022/05.yml +29 -29
- data/data/solutions/reddit/ruby/2022/06.yml +38 -38
- data/data/solutions/reddit/ruby/2022/07.yml +25 -25
- data/data/solutions/reddit/ruby/2022/08.yml +9 -9
- data/data/solutions/reddit/ruby/2022/09.yml +18 -18
- data/data/solutions/reddit/ruby/2022/10.yml +14 -14
- data/data/solutions/reddit/ruby/2022/11.yml +7 -7
- data/data/solutions/reddit/ruby/2022/12.yml +2 -2
- data/data/solutions/reddit/ruby/2022/13.yml +9 -9
- data/data/solutions/reddit/ruby/2022/14.yml +5 -5
- data/data/solutions/reddit/ruby/2022/15.yml +6 -6
- data/data/solutions/reddit/ruby/2022/16.yml +5 -5
- data/data/solutions/reddit/ruby/2022/17.yml +2 -2
- data/data/solutions/reddit/ruby/2022/18.yml +6 -6
- data/data/solutions/reddit/ruby/2022/19.yml +3 -3
- data/data/solutions/reddit/ruby/2022/20.yml +12 -12
- data/data/solutions/reddit/ruby/2022/21.yml +11 -11
- data/data/solutions/reddit/ruby/2022/22.yml +4 -4
- data/data/solutions/reddit/ruby/2022/24.yml +10 -10
- data/data/solutions/reddit/ruby/2022/25.yml +10 -10
- data/data/solutions/reddit/ruby/2023/01.yml +52 -52
- data/data/solutions/reddit/ruby/2023/02.yml +21 -21
- data/data/solutions/reddit/ruby/2023/03.yml +18 -18
- data/data/solutions/reddit/ruby/2023/04.yml +31 -31
- data/data/solutions/reddit/ruby/2023/05.yml +14 -14
- data/data/solutions/reddit/ruby/2023/06.yml +24 -24
- data/data/solutions/reddit/ruby/2023/07.yml +32 -32
- data/data/solutions/reddit/ruby/2023/08.yml +20 -20
- data/data/solutions/reddit/ruby/2023/09.yml +32 -32
- data/data/solutions/reddit/ruby/2023/10.yml +18 -18
- data/data/solutions/reddit/ruby/2023/11.yml +16 -16
- data/data/solutions/reddit/ruby/2023/12.yml +5 -5
- data/data/solutions/reddit/ruby/2023/13.yml +6 -6
- data/data/solutions/reddit/ruby/2023/14.yml +14 -14
- data/data/solutions/reddit/ruby/2023/15.yml +13 -13
- data/data/solutions/reddit/ruby/2023/16.yml +8 -8
- data/data/solutions/reddit/ruby/2023/18.yml +5 -5
- data/data/solutions/reddit/ruby/2023/19.yml +6 -6
- data/data/solutions/reddit/ruby/2023/20.yml +9 -9
- data/data/solutions/reddit/ruby/2023/21.yml +5 -5
- data/data/solutions/reddit/ruby/2023/22.yml +2 -2
- data/data/solutions/reddit/ruby/2023/23.yml +1 -1
- data/data/solutions/reddit/ruby/2023/25.yml +1 -1
- data/data/solutions/reddit/ruby/2024/01.yml +15 -15
- data/data/solutions/reddit/ruby/2024/02.yml +17 -17
- data/data/solutions/reddit/ruby/2024/03.yml +43 -43
- data/data/solutions/reddit/ruby/2024/04.yml +18 -18
- data/data/solutions/reddit/ruby/2024/05.yml +29 -29
- data/data/solutions/reddit/ruby/2024/06.yml +19 -19
- data/data/solutions/reddit/ruby/2024/07.yml +26 -26
- data/data/solutions/reddit/ruby/2024/08.yml +15 -15
- data/data/solutions/reddit/ruby/2024/09.yml +5 -5
- data/data/solutions/reddit/ruby/2024/10.yml +9 -9
- data/data/solutions/reddit/ruby/2024/11.yml +15 -15
- data/data/solutions/reddit/ruby/2024/12.yml +9 -9
- data/data/solutions/reddit/ruby/2024/13.yml +10 -10
- data/data/solutions/reddit/ruby/2024/14.yml +6 -6
- data/data/solutions/reddit/ruby/2024/15.yml +5 -5
- data/data/solutions/reddit/ruby/2024/16.yml +4 -4
- data/data/solutions/reddit/ruby/2024/17.yml +11 -11
- data/data/solutions/reddit/ruby/2024/18.yml +9 -9
- data/data/solutions/reddit/ruby/2024/19.yml +16 -16
- data/data/solutions/reddit/ruby/2024/20.yml +8 -8
- data/data/solutions/reddit/ruby/2024/21.yml +3 -3
- data/data/solutions/reddit/ruby/2024/22.yml +8 -8
- data/data/solutions/reddit/ruby/2024/23.yml +13 -13
- data/data/solutions/reddit/ruby/2024/24.yml +7 -7
- data/data/solutions/reddit/ruby/2024/25.yml +14 -14
- data/lib/arb/api/aoc.rb +2 -2
- data/lib/arb/cli/run.rb +2 -3
- data/lib/arb/version.rb +1 -1
- data/lib/download_solutions/api/reddit/get_serial_comments.rb +1 -1
- metadata +2 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: matas__
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyv9awf
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyv9awf
|
4
4
|
:body: |-
|
5
5
|
Ruby solution
|
6
6
|
|
@@ -45,7 +45,7 @@
|
|
45
45
|
```
|
46
46
|
:replies: []
|
47
47
|
- :author: BluFoot
|
48
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypur9z
|
48
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypur9z
|
49
49
|
:body: |-
|
50
50
|
**Ruby, golfed to 76 bytes**
|
51
51
|
|
@@ -55,7 +55,7 @@
|
|
55
55
|
```
|
56
56
|
:replies:
|
57
57
|
- :author: jstanley0
|
58
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypwkpc
|
58
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypwkpc
|
59
59
|
:body: |-
|
60
60
|
clever! my solution was just a bit longer
|
61
61
|
|
@@ -66,7 +66,7 @@
|
|
66
66
|
```
|
67
67
|
:replies:
|
68
68
|
- :author: jstanley0
|
69
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypx5ll
|
69
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypx5ll
|
70
70
|
:body: |-
|
71
71
|
after reading your solution I realized writing a lambda was totally pointless.
|
72
72
|
|
@@ -77,7 +77,7 @@
|
|
77
77
|
```
|
78
78
|
:replies: []
|
79
79
|
- :author: damagednoob
|
80
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqkjdg
|
80
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqkjdg
|
81
81
|
:body: |-
|
82
82
|
You can reduce this further using the `(x-96)%58` trick I've seen in other solutions
|
83
83
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
`p$<.each_slice(3).sum{|l|x=(65..).find{|c|l.all?{_1[c.chr]}};(x-96)%58}`
|
87
87
|
:replies: []
|
88
88
|
- :author: riffraff
|
89
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypuw49
|
89
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypuw49
|
90
90
|
:body: |-
|
91
91
|
ruby. I think there's a smarter way to get the number (other than conditionals), but I couldn't think of it
|
92
92
|
|
@@ -123,7 +123,7 @@
|
|
123
123
|
```
|
124
124
|
:replies:
|
125
125
|
- :author: ride7q
|
126
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypw062
|
126
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypw062
|
127
127
|
:body: |-
|
128
128
|
```ruby
|
129
129
|
#!/usr/bin/ruby
|
@@ -146,11 +146,11 @@
|
|
146
146
|
```
|
147
147
|
:replies: []
|
148
148
|
- :author: mathem17
|
149
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypw5wb
|
149
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypw5wb
|
150
150
|
:body: Ruby [code](https://github.com/jzhang113/adventofcode/blob/73b5e3a18ab204815b0a97e2852d5d7b311dd084/2022/solutions/03.rb), map-reduce ftw
|
151
151
|
:replies: []
|
152
152
|
- :author: Arakiyda
|
153
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq5t0v
|
153
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq5t0v
|
154
154
|
:body: |-
|
155
155
|
**Ruby:**
|
156
156
|
|
@@ -166,7 +166,7 @@
|
|
166
166
|
```
|
167
167
|
:replies: []
|
168
168
|
- :author: snowe2010
|
169
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyrt9dm
|
169
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyrt9dm
|
170
170
|
:body: |-
|
171
171
|
# Kotlin
|
172
172
|
|
@@ -214,11 +214,11 @@
|
|
214
214
|
```
|
215
215
|
:replies:
|
216
216
|
- :author: DanZuko420
|
217
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyuc6w1
|
217
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyuc6w1
|
218
218
|
:body: I hadn't seen the ord method used before I started looking at answers in these threads, very clever! I'll have to try this
|
219
219
|
:replies: []
|
220
220
|
- :author: InevitableYak1979
|
221
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytgbl1
|
221
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytgbl1
|
222
222
|
:body: |-
|
223
223
|
Ruby:
|
224
224
|
|
@@ -247,15 +247,15 @@
|
|
247
247
|
```
|
248
248
|
:replies:
|
249
249
|
- :author: OwnAttention3370
|
250
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytldaq
|
250
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytldaq
|
251
251
|
:body: Interesting approach. I'm using Ruby also as I'm learning the language and noted your use of reduce. It is similar to inject correct?
|
252
252
|
:replies:
|
253
253
|
- :author: InevitableYak1979
|
254
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytwlst
|
254
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytwlst
|
255
255
|
:body: Yep, in Ruby, reduce is an alias for inject.
|
256
256
|
:replies: []
|
257
257
|
- :author: nithinbekal
|
258
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypz2l2
|
258
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypz2l2
|
259
259
|
:body: |-
|
260
260
|
[**Ruby solution**](https://github.com/nithinbekal/advent-of-code/blob/22b2299cefaeb6c5005ef5f7d5efd0343c9f1055/lib/03.rb)
|
261
261
|
|
@@ -291,7 +291,7 @@
|
|
291
291
|
```
|
292
292
|
:replies: []
|
293
293
|
- :author: ni3t
|
294
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypzskz
|
294
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iypzskz
|
295
295
|
:body: |-
|
296
296
|
# Ruby
|
297
297
|
|
@@ -324,23 +324,23 @@
|
|
324
324
|
```
|
325
325
|
:replies: []
|
326
326
|
- :author: "[deleted]"
|
327
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq440y
|
327
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq440y
|
328
328
|
:body: "# [Ruby](https://github.com/sreedevk/advent-of-code/blob/main/ruby/2022/day3/main.rb)"
|
329
329
|
:replies:
|
330
330
|
- :author: craigontour
|
331
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqcfow
|
331
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqcfow
|
332
332
|
:body: You do everything with classes then? Very clean.
|
333
333
|
:replies:
|
334
334
|
- :author: "[deleted]"
|
335
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyrtguj
|
335
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyrtguj
|
336
336
|
:body: I started using this style only last year. I noticed that its way easier to memoize functions this way. Thank you!
|
337
337
|
:replies:
|
338
338
|
- :author: craigontour
|
339
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyusbds
|
339
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyusbds
|
340
340
|
:body: I have tried classes myself and understand the concept, but struggle with their construction.
|
341
341
|
:replies: []
|
342
342
|
- :author: dtinth
|
343
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq5krd
|
343
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq5krd
|
344
344
|
:body: |-
|
345
345
|
**GitHub Copilot + Ruby** (4 / 25)
|
346
346
|
|
@@ -385,14 +385,14 @@
|
|
385
385
|
So making code readable does not only help me, but helps Copilot too.
|
386
386
|
:replies: []
|
387
387
|
- :author: Helk16
|
388
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqh2ng
|
388
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqh2ng
|
389
389
|
:body: |-
|
390
390
|
One of **Ruby** solution (need to refactor the second part to use recursivity maybe)
|
391
391
|
|
392
392
|
[https://gitlab.com/LeChPunk/advent\_of\_code/-/tree/main/day\_3](https://gitlab.com/LeChPunk/advent_of_code/-/tree/main/day_3)
|
393
393
|
:replies: []
|
394
394
|
- :author: careyi4
|
395
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqhyuy
|
395
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqhyuy
|
396
396
|
:body: |-
|
397
397
|
Ruby
|
398
398
|
|
@@ -401,11 +401,11 @@
|
|
401
401
|
Video Walkthrough: https://youtu.be/jeZu8oe2Uy4
|
402
402
|
:replies: []
|
403
403
|
- :author: ScaredOfMyRawr
|
404
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqizx4
|
404
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqizx4
|
405
405
|
:body: "[My solution in Ruby](https://medium.com/@ashley-peacock/advent-of-code-2022-day-3-solution-rucksack-reorganization-bd2615247bef), I think it's pretty solid, but probably a clever way to do it without looping as much!"
|
406
406
|
:replies:
|
407
407
|
- :author: matas__
|
408
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqo6vb
|
408
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqo6vb
|
409
409
|
:body: |-
|
410
410
|
this is solid :D day\_2:
|
411
411
|
|
@@ -456,7 +456,7 @@
|
|
456
456
|
```
|
457
457
|
:replies: []
|
458
458
|
- :author: matas__
|
459
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqnuw7
|
459
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqnuw7
|
460
460
|
:body: |-
|
461
461
|
Ruby code, simple
|
462
462
|
|
@@ -515,7 +515,7 @@
|
|
515
515
|
```
|
516
516
|
:replies:
|
517
517
|
- :author: '442401'
|
518
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqudc9
|
518
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqudc9
|
519
519
|
:body: |-
|
520
520
|
Hi /u/matas\_\_ . Thanks for sharing your solution, it's great to see how others approach the problems.
|
521
521
|
|
@@ -524,7 +524,7 @@
|
|
524
524
|
See https://www.reddit.com/r/adventofcode/wiki/faqs/automation
|
525
525
|
:replies: []
|
526
526
|
- :author: jeffers0n
|
527
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyrexpj
|
527
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyrexpj
|
528
528
|
:body: |-
|
529
529
|
Ruby
|
530
530
|
|
@@ -533,7 +533,7 @@
|
|
533
533
|
I used regex to find character sequences instead of counting them in a hash.
|
534
534
|
:replies: []
|
535
535
|
- :author: MartinSch64
|
536
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iys7y56
|
536
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iys7y56
|
537
537
|
:body: |-
|
538
538
|
My solution in Ruby, with focus on readability as it should be
|
539
539
|
|
@@ -576,21 +576,21 @@
|
|
576
576
|
```
|
577
577
|
:replies:
|
578
578
|
- :author: petepete
|
579
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iysmgb4
|
579
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iysmgb4
|
580
580
|
:body: |-
|
581
581
|
I also enjoy making mine (somewhat) readable.
|
582
582
|
|
583
583
|
https://github.com/peteryates/advent-of-code-2022/blob/main/03/rucksack.rb
|
584
584
|
:replies: []
|
585
585
|
- :author: CSEcon
|
586
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyspp95
|
586
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyspp95
|
587
587
|
:body: |-
|
588
588
|
**ruby**
|
589
589
|
|
590
590
|
[gist](https://gist.github.com/mehryar-m/5674fe850f83c6e3e09fe97c31eebac9)
|
591
591
|
:replies: []
|
592
592
|
- :author: ffrkAnonymous
|
593
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytd56k
|
593
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iytd56k
|
594
594
|
:body: |-
|
595
595
|
Ruby
|
596
596
|
|
@@ -601,7 +601,7 @@
|
|
601
601
|
Part 1 was learning how to traverse the strings one character at a time. Part 2 was learning how to convert the string into an array and use the built-in intersection method.
|
602
602
|
:replies: []
|
603
603
|
- :author: naturaln0va
|
604
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq0y34
|
604
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyq0y34
|
605
605
|
:body: |-
|
606
606
|
**Ruby**
|
607
607
|
|
@@ -632,7 +632,7 @@
|
|
632
632
|
```
|
633
633
|
:replies: []
|
634
634
|
- :author: '0x14f'
|
635
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqgjeh
|
635
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyqgjeh
|
636
636
|
:body: |-
|
637
637
|
### Ruby
|
638
638
|
|
@@ -668,7 +668,7 @@
|
|
668
668
|
```
|
669
669
|
:replies: []
|
670
670
|
- :author: radiales
|
671
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyr45cz
|
671
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zb865p/2022_day_3_solutions/iyr45cz
|
672
672
|
:body: |-
|
673
673
|
Ruby
|
674
674
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: ffrkAnonymous
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iz7zyhh
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iz7zyhh
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
Learning ruby. Very clunky.
|
10
10
|
:replies:
|
11
11
|
- :author: PiurEwil
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1p89i4
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1p89i4
|
13
13
|
:body: |-
|
14
14
|
That's actually not _very_ clunky! :) Just a few common Ruby idioms, and it will be perfectly nice code!
|
15
15
|
|
@@ -31,7 +31,7 @@
|
|
31
31
|
Keep up the good work! :)
|
32
32
|
:replies:
|
33
33
|
- :author: ffrkAnonymous
|
34
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1rr1v9
|
34
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1rr1v9
|
35
35
|
:body: |-
|
36
36
|
wow, thanks for the thoughtful christmas present. I'm glad my 4th day of ruby wasn't totally awful.
|
37
37
|
|
@@ -50,7 +50,7 @@
|
|
50
50
|
Might I pick your brain about multi-dimensional data-structure? For Day 8, 12, 14? I played with Hash of complex `0+0i` which felt clean but not extendable to 3d, and I'm trying out hashes of hashes for day 14. Array of Array doesn't seem any easier, and 500\*500 nil rubs me the wrong way.
|
51
51
|
:replies:
|
52
52
|
- :author: PiurEwil
|
53
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1wm0wk
|
53
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1wm0wk
|
54
54
|
:body: |-
|
55
55
|
The good thing about Advent of Code, as opposed to some other programming contests, is that it's entirely optional to optimize your code (for speed, memory usage, complexity class etc.), so you can focus on whatever pleases you. I typically write the most straightforward and "readable" code that comes to me, even if in the back of my mind something is nagging me about red-black trees and other less enjoyable things :D So, if you feel that a `Hash` of `Hash`es represents the problem nicely, then go forward and have no regrets ;)
|
56
56
|
|
@@ -71,11 +71,11 @@
|
|
71
71
|
Yeah, there's a bunch of these (autoformatters/linters). These built into IDEs and standalone, like `rubocop`. Just try not to overdo them - they are supposed to help you, not make your life harder. For me a linter is only requires when I work on a project with multiple people - to enforce an agreed-upon coding standard. Then again, I already have a somewhat quirky preferred style ;)
|
72
72
|
:replies:
|
73
73
|
- :author: ffrkAnonymous
|
74
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1x1mex
|
74
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/j1x1mex
|
75
75
|
:body: "Yeah, for day9 monkeys i learned classes. I was very confused why ruby complained that my methods (attributes) didn't exist. \U0001F61B\n\nYour tree array demonstrated something I read long ago: choose the right data structure and your code writes itself. For now I'm just getting familiar with the basic structures (and limitations). `Hash` of `Hash`es is more \"dunno what other options/structures to choose from\". So just experiementing before I reach the wacky trees and graphs for the later days.\n\nThank you again for your advice and wisdom."
|
76
76
|
:replies: []
|
77
77
|
- :author: SolarBear
|
78
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvahdo
|
78
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvahdo
|
79
79
|
:body: |-
|
80
80
|
Ruby solution. Again, using Ruby felt like cheating.
|
81
81
|
|
@@ -106,11 +106,11 @@
|
|
106
106
|
```
|
107
107
|
:replies:
|
108
108
|
- :author: dikkie91
|
109
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvdq3d
|
109
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvdq3d
|
110
110
|
:body: Your solution looks quite similar to what I did in Scala..
|
111
111
|
:replies: []
|
112
112
|
- :author: Alleyria
|
113
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywoenf
|
113
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywoenf
|
114
114
|
:body: |-
|
115
115
|
Ruby:
|
116
116
|
|
@@ -125,7 +125,7 @@
|
|
125
125
|
```
|
126
126
|
:replies: []
|
127
127
|
- :author: Arakiyda
|
128
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyudv3p
|
128
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyudv3p
|
129
129
|
:body: |-
|
130
130
|
**Ruby**
|
131
131
|
|
@@ -142,26 +142,26 @@
|
|
142
142
|
```
|
143
143
|
:replies:
|
144
144
|
- :author: mathem17
|
145
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyueqa6
|
145
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyueqa6
|
146
146
|
:body: Huh neat, I didn't realize cover? was a thing. It feels like there's a ruby function for everything you need.
|
147
147
|
:replies:
|
148
148
|
- :author: Arakiyda
|
149
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuf50x
|
149
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuf50x
|
150
150
|
:body: Right? I love Ruby for how often I find exactly what I'm looking for when I read the docs for a class
|
151
151
|
:replies:
|
152
152
|
- :author: MartinSch64
|
153
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyx6nwt
|
153
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyx6nwt
|
154
154
|
:body: Rubys standart library is indeed very nice.
|
155
155
|
:replies: []
|
156
156
|
- :author: jeffers0n
|
157
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvs13d
|
157
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvs13d
|
158
158
|
:body: |-
|
159
159
|
Ruby
|
160
160
|
|
161
161
|
Did everything with Range objects and the "cover?" method. https://git.doublehack.me/s00ner/AoC2022/src/branch/main/day04/solution.rb
|
162
162
|
:replies: []
|
163
163
|
- :author: DanZuko420
|
164
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywjta7
|
164
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywjta7
|
165
165
|
:body: |-
|
166
166
|
Day 4 solution with Ruby. I had an easier time grokking today's than previous days, for some reason. I tried to do that last loop in one line, but I was getting my syntax or formatting wrong or something and it didn't work. I don't like the extra lines but I'm not golfing
|
167
167
|
|
@@ -192,7 +192,7 @@
|
|
192
192
|
```
|
193
193
|
:replies:
|
194
194
|
- :author: '442401'
|
195
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxjrrp
|
195
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxjrrp
|
196
196
|
:body: |-
|
197
197
|
is
|
198
198
|
|
@@ -203,18 +203,18 @@
|
|
203
203
|
what you were looking for?
|
204
204
|
:replies:
|
205
205
|
- :author: DanZuko420
|
206
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxn19q
|
206
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxn19q
|
207
207
|
:body: Yes! Thank you. I was doing `overlap_count +=1; break if two.to_a.include?(_1)`
|
208
208
|
:replies:
|
209
209
|
- :author: '442401'
|
210
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxot0k
|
210
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxot0k
|
211
211
|
:body: |-
|
212
212
|
Ah yes, that would increment with every iteration until the break condition is met.
|
213
213
|
|
214
214
|
Happy to help.
|
215
215
|
:replies: []
|
216
216
|
- :author: thedjotaku
|
217
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywyqb2
|
217
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywyqb2
|
218
218
|
:body: |-
|
219
219
|
Ruby
|
220
220
|
|
@@ -223,14 +223,14 @@
|
|
223
223
|
I know it's not idiomatic (I think?). It's a cross between what I did with Python and some Ruby idioms.
|
224
224
|
:replies: []
|
225
225
|
- :author: CSEcon
|
226
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywzjrk
|
226
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywzjrk
|
227
227
|
:body: |-
|
228
228
|
ruby
|
229
229
|
|
230
230
|
[gist](https://gist.github.com/mehryar-m/d19c99cc65f12d248e7c18ae385e56c9)
|
231
231
|
:replies: []
|
232
232
|
- :author: tobyaw
|
233
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyx9z0g
|
233
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyx9z0g
|
234
234
|
:body: |-
|
235
235
|
Ruby
|
236
236
|
|
@@ -250,7 +250,7 @@
|
|
250
250
|
```
|
251
251
|
:replies: []
|
252
252
|
- :author: antoniotto
|
253
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxapgy
|
253
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxapgy
|
254
254
|
:body: |-
|
255
255
|
Ruby
|
256
256
|
|
@@ -267,7 +267,7 @@
|
|
267
267
|
```
|
268
268
|
:replies: []
|
269
269
|
- :author: nithinbekal
|
270
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyubm0h
|
270
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyubm0h
|
271
271
|
:body: |-
|
272
272
|
### Ruby
|
273
273
|
|
@@ -297,7 +297,7 @@
|
|
297
297
|
[Github](https://github.com/nithinbekal/advent-of-code/blob/e7af75a86b7ff9160e6f95b3b9dd5c41a6b8845f/lib/04.rb)
|
298
298
|
:replies: []
|
299
299
|
- :author: BluFoot
|
300
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyubrfg
|
300
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyubrfg
|
301
301
|
:body: |-
|
302
302
|
**Ruby** , golfed to 81 bytes
|
303
303
|
|
@@ -320,7 +320,7 @@
|
|
320
320
|
```
|
321
321
|
:replies:
|
322
322
|
- :author: damagednoob
|
323
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuzi5z
|
323
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuzi5z
|
324
324
|
:body: |-
|
325
325
|
My version at 76 bytes:
|
326
326
|
|
@@ -329,7 +329,7 @@
|
|
329
329
|
```
|
330
330
|
:replies:
|
331
331
|
- :author: BluFoot
|
332
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyviqrl
|
332
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyviqrl
|
333
333
|
:body: |-
|
334
334
|
Ahh, the regex, nice!! I also realized that `to_i` is unnecessary. Down to ~~65~~ ~~63~~ 60 bytes!
|
335
335
|
|
@@ -339,7 +339,7 @@
|
|
339
339
|
```
|
340
340
|
:replies:
|
341
341
|
- :author: '442401'
|
342
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxlefn
|
342
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxlefn
|
343
343
|
:body: |-
|
344
344
|
Nice getting rid of `to_i`.
|
345
345
|
|
@@ -348,14 +348,14 @@
|
|
348
348
|
I fell for it, as did almost all others here.
|
349
349
|
:replies: []
|
350
350
|
- :author: ScaredOfMyRawr
|
351
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyv0ifs
|
351
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyv0ifs
|
352
352
|
:body: |-
|
353
353
|
[My solution in Ruby](https://medium.com/@ashley-peacock/advent-of-code-2022-day-4-solution-overlapping-sections-d22b9f9467d2). Pretty simple overall, but I think it can be improved.
|
354
354
|
|
355
355
|
I think there's a jazzy algorithm to do this, but I can't quite recall what it is, would love to know though! All my brain could think about was sliding windows but I don't think that's useful here as we're not trying to find an overall range etc.
|
356
356
|
:replies: []
|
357
357
|
- :author: hdf1986
|
358
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyv6mux
|
358
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyv6mux
|
359
359
|
:body: |-
|
360
360
|
**Ruby**
|
361
361
|
|
@@ -402,7 +402,7 @@
|
|
402
402
|
```
|
403
403
|
:replies: []
|
404
404
|
- :author: vinc686
|
405
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyv8jy8
|
405
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyv8jy8
|
406
406
|
:body: |-
|
407
407
|
[**ruby**](https://github.com/vinc/advent-of-code/tree/master/ruby/2022/04)
|
408
408
|
|
@@ -413,7 +413,7 @@
|
|
413
413
|
```
|
414
414
|
:replies: []
|
415
415
|
- :author: d_chae
|
416
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvdrob
|
416
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvdrob
|
417
417
|
:body: |-
|
418
418
|
Ruby one-liner (p2):
|
419
419
|
|
@@ -422,18 +422,18 @@
|
|
422
422
|
```
|
423
423
|
:replies:
|
424
424
|
- :author: jstanley0
|
425
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvm1m0
|
425
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvm1m0
|
426
426
|
:body: |-
|
427
427
|
props for not writing an O(N\*\*2) range overlap test like others here did ;)
|
428
428
|
|
429
429
|
I would suggest using `count` rather than `reduce` here though
|
430
430
|
:replies:
|
431
431
|
- :author: d_chae
|
432
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxc4f0
|
432
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyxc4f0
|
433
433
|
:body: Ah, I totally forgot about count! Thank you
|
434
434
|
:replies: []
|
435
435
|
- :author: jstanley0
|
436
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvidjd
|
436
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvidjd
|
437
437
|
:body: |-
|
438
438
|
**Ruby**
|
439
439
|
|
@@ -455,7 +455,7 @@
|
|
455
455
|
EDIT 2: I looked at ActiveSupport to see the source for `Range#overlaps?` and it's dead simple: `cover?(other.first) || other.cover?(first)`. Should have thought of that. At least now I know how to use ActiveSupport outside Rails.
|
456
456
|
:replies: []
|
457
457
|
- :author: OwnAttention3370
|
458
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywhjds
|
458
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iywhjds
|
459
459
|
:body: |-
|
460
460
|
Ruby - My solution to AoC day 4
|
461
461
|
|
@@ -505,11 +505,11 @@
|
|
505
505
|
```
|
506
506
|
:replies: []
|
507
507
|
- :author: "[deleted]"
|
508
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyx2d80
|
508
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyx2d80
|
509
509
|
:body: "# [Ruby](https://github.com/sreedevk/advent-of-code/blob/main/ruby/2022/day4/main.rb)"
|
510
510
|
:replies: []
|
511
511
|
- :author: snowe2010
|
512
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuqkjp
|
512
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuqkjp
|
513
513
|
:body: |-
|
514
514
|
# Ruby
|
515
515
|
|
@@ -553,7 +553,7 @@
|
|
553
553
|
Edit: I just realized I’m an idiot and this was trivially solvable with regex and I’m over here doing complicated splits. Ugh. I’ll fix it tomorrow.
|
554
554
|
:replies: []
|
555
555
|
- :author: craigontour
|
556
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyurpvn
|
556
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyurpvn
|
557
557
|
:body: |-
|
558
558
|
# Ruby
|
559
559
|
|
@@ -581,7 +581,7 @@
|
|
581
581
|
Update: reformatted for Reddit.
|
582
582
|
:replies:
|
583
583
|
- :author: craigontour
|
584
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyurtrq
|
584
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyurtrq
|
585
585
|
:body: |-
|
586
586
|
HELP! I pasted in from vcode (MacOS), where using spaces for indentation and CRLF, but it would not format properly as code block. I had to paste and reformat line by line to get it right.
|
587
587
|
|
@@ -590,15 +590,15 @@
|
|
590
590
|
Cheers
|
591
591
|
:replies:
|
592
592
|
- :author: nysra
|
593
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuxj24
|
593
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuxj24
|
594
594
|
:body: Reddit needs 4 spaces in front of every single line of a codeblock. Generally selecting the entire code, pressing tab once, and then copying from VSC into Reddit works (on every platform and CRLF doesn't matter). Your output looks very much like you simply copied the code without indenting it first, but hard to say without you telling us exactly what you did.
|
595
595
|
:replies: []
|
596
596
|
- :author: craigontour
|
597
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iz02e3q
|
597
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iz02e3q
|
598
598
|
:body: did as instructed and got it now. thanks.
|
599
599
|
:replies: []
|
600
600
|
- :author: careyi4
|
601
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuyg1z
|
601
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyuyg1z
|
602
602
|
:body: |-
|
603
603
|
Ruby
|
604
604
|
|
@@ -607,7 +607,7 @@
|
|
607
607
|
Video Walkthrough: https://youtu.be/ZiPmNii7faU
|
608
608
|
:replies: []
|
609
609
|
- :author: InevitableYak1979
|
610
|
-
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvuc6m
|
610
|
+
:url: https://www.reddit.com/r/adventofcode/comments/zc0zta/2022_day_4_solutions/iyvuc6m
|
611
611
|
:body: |-
|
612
612
|
Ruby
|
613
613
|
|