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,13 +1,13 @@
|
|
1
1
|
---
|
2
2
|
- :author: nibbl
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gitttl7
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gitttl7
|
4
4
|
:body: |-
|
5
5
|
**Nim**
|
6
6
|
|
7
7
|
[NoPaste snippet](https://nopaste.ml/?l=ruby#XQAAAQCZBAAAAAAAAAAzHIoib6qv/FV7Zr1CCFnA3F5kN8XW/PRzW/6iKAB8+gNtESkcKVq4oT5mMXxrSfKJM0h0k1A0K+ECNtDvbjlukQf/qavQNcFATWDPr0+o1Y93GSZEQ4GeFUj8M6cFu9d5YGrmWFF5gcfNOLlFudy5LeBSq51BeMvh0vpqlvB3Q9bo/aTttYwfkc13+d5ihFVf6lby7UErc0whv0ipqEovXg5KeA28ytLkdVIaMTqSXHP6FXLr3kcHFuLo/U6INO6JVbC+P5T5i/4ZHeWj/AqwQYNS4d6hGojGhFPnQcEAhWg9vbhEb7ZPHHPucUHKqyZykjr3FuCvTjRKQq/GBX0VXId9aPj8z8xz+DrVh8Op7HDgeF2/CDL/d1udbJgllaZ3HQin0ODEohWKWLEFCO2cjP6n1cE020ToYluUt1lq9CdR08KULkXIPFPC7NsH0GcB1r8gUdjYrtie5yiQjJh8PTYOQG7eUSdRYy38jCcPZhFB569TdKiTwNc6IliP6NoFr6H17rGib04ieQCpV6/HDA0QkLBCinchJfPi24Gp85tN5UaAG7q57TCrhjXqPSEnOu729XWZE8coAXSA7fHK1j3SspSoL7yVG1eMtp0DFCdawrdQ0fukuTi45GsMXHrJGABCWeQAwNahtV6ziivUZko1Uq5mgfZroq+m8B9ysgw2EudLxP4l10e75DENO8Kh12xJAf57+xeiSg==)
|
8
8
|
:replies: []
|
9
9
|
- :author: Wattswing
|
10
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/ghlql73
|
10
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/ghlql73
|
11
11
|
:body: |-
|
12
12
|
Ruby [code](https://topaz.github.io/paste/#XQAAAQBhBgAAAAAAAAA0m4poOBCMftdkRQiciXYGFBdGwl8V/4u3Ir2Ib+in6tp5plipJucjjc1Wk5RAef+7DejTvUFMX3TaZWt8JygEErYcm1k6rFOFsu7jrj56CTbPhzVdY1zUx6dpoV1ha2YERKvcalPzM0/PFw1+2isxhgG8dcxCJVKSmWI2tVNrgERts+sUnaZTM1lWfpE7H7BN/Dl3QVMWrW0PkQyMonuEgjZhqm5i82usQ7afH8QBWF3OMi1DGKl3ke/R4ENZFyhONaHPbK2ck0lX+6ST8uc40BbSV5sjFs3COZaZ9vjncma1fZ68AM8HSfjrJMy3ZGWNgHrpCSSmX5U61MoNJTKK2zecn2odk+vXw7HNVXkfyUdE2I9emWnHgXvgV2dwLvrSMMyiXvUAIgRoVVM/MQIBb5hMILV43IOKGVgsQeRM1ESP7USQ6o+afO52g8Ly524riw7lXRgKc8et4WfR4J/rjI2IT9CMzLyZ30GM23JlL0abEyzWgnx09Bc8C5pt1H5p+IMWE42e5SFcy+opi+I8ScYqAgP0yKEfdefl95Oq8qMuvc4UfB/V7F0hAjyO4axFZkMU1Q0aThVB85ADx4VKFCKC7FvdjMJB6uwo8q/J6d3UHWkZFSEu9wIiSPDzU8yaPx0uXolzJ2gVu/wQSeG209gy7tg2HF9jijqu2sSjh7KXaOYQ+3tBId6GLgIMpwJSuLUQdw6ZgP6r0Nmvvq5KTjHuWW44A2suZDTt1kGCtMPlh5CqhPfpWej7BulRxIUuLYfAv/T2plv8rpAuPQqvTKnN5m4N1csWq4oVGfcv62bhUOf/9ogGow==)
|
13
13
|
|
@@ -72,7 +72,7 @@
|
|
72
72
|
As I struggled with this, valid passports yielded 22 results, but it wasn't correct. By skipping leading zeroes check, I finally got the right answer.
|
73
73
|
:replies: []
|
74
74
|
- :author: nrith
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gg06u7u
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gg06u7u
|
76
76
|
:body: |-
|
77
77
|
Ruby, part 1:
|
78
78
|
|
@@ -95,7 +95,7 @@
|
|
95
95
|
```
|
96
96
|
:replies: []
|
97
97
|
- :author: blafunke
|
98
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/geprjcb
|
98
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/geprjcb
|
99
99
|
:body: |-
|
100
100
|
Everything looks like yaml to me.
|
101
101
|
|
@@ -157,7 +157,7 @@
|
|
157
157
|
```
|
158
158
|
:replies: []
|
159
159
|
- :author: Krakhan
|
160
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/geok056
|
160
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/geok056
|
161
161
|
:body: |-
|
162
162
|
**Ruby**
|
163
163
|
|
@@ -204,7 +204,7 @@
|
|
204
204
|
```
|
205
205
|
:replies: []
|
206
206
|
- :author: ndnenkov
|
207
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekxq2j
|
207
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekxq2j
|
208
208
|
:body: |-
|
209
209
|
> **Regex** is like violence - if it doesn't solve your problems you aren't using enough of it.
|
210
210
|
|
@@ -213,7 +213,7 @@
|
|
213
213
|
(Ruby regex one-liner)
|
214
214
|
:replies: []
|
215
215
|
- :author: zB0hs
|
216
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gempzqj
|
216
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gempzqj
|
217
217
|
:body: |-
|
218
218
|
Here's a pointless one-liner in Ruby for Part 2 that relies on a single regex to validate a passport:
|
219
219
|
|
@@ -222,7 +222,7 @@
|
|
222
222
|
```
|
223
223
|
:replies: []
|
224
224
|
- :author: petercooper
|
225
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gel4pb2
|
225
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gel4pb2
|
226
226
|
:body: |-
|
227
227
|
**Ruby** This is the first day I would have been on the leaderboard if I actually did challenges when they launch :-) Ruby made light work of part 2 of this challenge, so my stopwatch showed 9m28s!
|
228
228
|
|
@@ -248,19 +248,19 @@
|
|
248
248
|
```
|
249
249
|
:replies:
|
250
250
|
- :author: odlp
|
251
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gelkuzo
|
251
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gelkuzo
|
252
252
|
:body: The `scan` + `to_h` combo is great. I have shamelessly ~~borrowed~~ stolen this and updated my solution.
|
253
253
|
:replies:
|
254
254
|
- :author: petercooper
|
255
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gelpshe
|
255
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gelpshe
|
256
256
|
:body: Fill your boots, as we say here! :) I have learnt so much from reading other people's code as well.
|
257
257
|
:replies: []
|
258
258
|
- :author: jeffers0n
|
259
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gelo8q8
|
259
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gelo8q8
|
260
260
|
:body: Thanks for posting this. I've been doing mine in Ruby to learn it better and reading your solution makes me realize I need to learn Ruby's built in functions more.
|
261
261
|
:replies: []
|
262
262
|
- :author: zxywx
|
263
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gem4wnm
|
263
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gem4wnm
|
264
264
|
:body: |-
|
265
265
|
# Single Regex Solutions
|
266
266
|
|
@@ -283,7 +283,7 @@
|
|
283
283
|
```
|
284
284
|
:replies: []
|
285
285
|
- :author: eregontp
|
286
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genfsgu
|
286
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genfsgu
|
287
287
|
:body: |-
|
288
288
|
Ruby, part 2
|
289
289
|
|
@@ -315,7 +315,7 @@
|
|
315
315
|
```
|
316
316
|
:replies:
|
317
317
|
- :author: sorghum
|
318
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genhhy1
|
318
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genhhy1
|
319
319
|
:body: |-
|
320
320
|
Cool, I ended up with almost the same thing after refactoring:
|
321
321
|
|
@@ -342,7 +342,7 @@
|
|
342
342
|
```
|
343
343
|
:replies: []
|
344
344
|
- :author: Karl_Marxxx
|
345
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genjztv
|
345
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genjztv
|
346
346
|
:body: |-
|
347
347
|
> value = data[name.to\_s] and predicate === value
|
348
348
|
|
@@ -351,15 +351,15 @@
|
|
351
351
|
Edit: I get that some strings can be compared ('===') to the bare regexes, but how does that work for the other stuff that appears to be returning a boolean?
|
352
352
|
:replies:
|
353
353
|
- :author: sorghum
|
354
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genmy3k
|
354
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genmy3k
|
355
355
|
:body: 'The triple equals is known as the case equality operator. Here the === method is being called on the regex/proc. The === method is also called whenever an object is used in a case/when statement. Good intro here: https://blog.arkency.com/the-equals-equals-equals-case-equality-operator-in-ruby/'
|
356
356
|
:replies:
|
357
357
|
- :author: Karl_Marxxx
|
358
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genrlrz
|
358
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genrlrz
|
359
359
|
:body: Ah cool thank you!
|
360
360
|
:replies: []
|
361
361
|
- :author: Karl_Marxxx
|
362
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genia6n
|
362
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/genia6n
|
363
363
|
:body: |-
|
364
364
|
Ruby
|
365
365
|
|
@@ -395,7 +395,7 @@
|
|
395
395
|
```
|
396
396
|
:replies: []
|
397
397
|
- :author: odlp
|
398
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gel9vm3
|
398
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gel9vm3
|
399
399
|
:body: |-
|
400
400
|
My [Ruby solution](https://github.com/odlp/advent-of-code-2020/blob/main/day-4/passports.rb):
|
401
401
|
|
@@ -438,7 +438,7 @@
|
|
438
438
|
```
|
439
439
|
:replies: []
|
440
440
|
- :author: "[deleted]"
|
441
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gem3ljg
|
441
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gem3ljg
|
442
442
|
:body: |-
|
443
443
|
This was a good use case for Ruby's ActiveModel
|
444
444
|
|
@@ -519,7 +519,7 @@
|
|
519
519
|
```
|
520
520
|
:replies: []
|
521
521
|
- :author: ttapu
|
522
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gen4bgb
|
522
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gen4bgb
|
523
523
|
:body: |-
|
524
524
|
my ruby solution, but i still hate regex...
|
525
525
|
|
@@ -569,7 +569,7 @@
|
|
569
569
|
```
|
570
570
|
:replies: []
|
571
571
|
- :author: gurgeous
|
572
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekf68w
|
572
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekf68w
|
573
573
|
:body: |-
|
574
574
|
47/34. This one was made for Ruby. Some slight cleanup here. Main bug I encountered was foolishly leaving the # off the front of one regex.
|
575
575
|
|
@@ -612,7 +612,7 @@
|
|
612
612
|
```
|
613
613
|
:replies: []
|
614
614
|
- :author: frontpageminus
|
615
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekfhq8
|
615
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekfhq8
|
616
616
|
:body: |-
|
617
617
|
Ruby - 169/133
|
618
618
|
|
@@ -643,7 +643,7 @@
|
|
643
643
|
```
|
644
644
|
:replies: []
|
645
645
|
- :author: ni3t
|
646
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekm3hn
|
646
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gekm3hn
|
647
647
|
:body: |-
|
648
648
|
# Ruby
|
649
649
|
|
@@ -679,7 +679,7 @@
|
|
679
679
|
```
|
680
680
|
:replies: []
|
681
681
|
- :author: Piggelinmannen
|
682
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/geksy9s
|
682
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/geksy9s
|
683
683
|
:body: |-
|
684
684
|
Solution in Ruby. Part a is clean enough, but part 2 became quite ugly.
|
685
685
|
|
@@ -726,7 +726,7 @@
|
|
726
726
|
```
|
727
727
|
:replies: []
|
728
728
|
- :author: CodeIsTheEnd
|
729
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gektlnt
|
729
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k6e8sw/2020_day_04_solutions/gektlnt
|
730
730
|
:body: |-
|
731
731
|
**Ruby:** (4:23/16:48, 170/244)
|
732
732
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
- :author: Wattswing
|
3
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gijw9ky
|
3
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gijw9ky
|
4
4
|
:body: |-
|
5
5
|
Ruby
|
6
6
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
[Code](https://topaz.github.io/paste/#XQAAAQCHBAAAAAAAAAApE8c0yCtOWkGXsb6/Ap/R1MYgWM5XNu2zBIG74I4DeAsdgNBV2lzbiBbOkazv49erCRDEXPtGg9d5LXWxSNbhy6pzusIs2GRsWmq1qH/hXYHz5LN7qZ+QcVtaGM3Z8RN8RMcFrq0/B1xfa+CnH4s5qh+iIFDKXAGQzGJY8Ich8Kza4V/gpZAsL5AW3yRwJXrwkdMZw/Kl5CcNAfaKv3XrLmcIPFH0mmd1PqfzRsTG1RuGArLU6XsyJcbodtq7rtqxNW4kqr3xRLmggVdZb+/or0tVAn+SBDCkQuBt445jdLlJx1o1olRUHihTOEq+O0rnFV4SpnSMJem28egTUkiiIH7ZCqC6kUQyjyjEO/c5G21TVqK5Gl5E/ffyCwaDbHx1VX7TP8JcnWY0HW76eRNM2lVbMd9fxo6SGabY2mpSsOskN8e1VhlAjLkyvpi9f3EAAWUaEhYcclfTcZKW6UW2bB9hMBwHfgxL9/vraSzDd+vIXDBJ+lwQjsGKRnwcR2A4CFapuFLaDCM5+WsoBoZ5mM8WPO6Te64G4DdawIm+NIXHMfs7exei+T7Z7RI9R7Z9Sw8Mq2yEespPyZzC72nGZTT7FcqSdK3YWNjy5XpD/awWsMR3pfNwlPW2uWM+bJ4U8+OZJOsc5SwCM1b7sTHOsC/QqKxRMrDxnjeXYFVqeEyBL69AV2Ft6OsW7qpz/8xk80A=)
|
10
10
|
:replies: []
|
11
11
|
- :author: Karl_Marxxx
|
12
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gey4bu4
|
12
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gey4bu4
|
13
13
|
:body: |-
|
14
14
|
Ruby
|
15
15
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
```
|
24
24
|
:replies: []
|
25
25
|
- :author: purplepinapples
|
26
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geu1bdg
|
26
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geu1bdg
|
27
27
|
:body: |-
|
28
28
|
In ruby. Was stuck for a while because I didnt realize `IO.readlines` doesnt strip newlines
|
29
29
|
|
@@ -65,14 +65,14 @@
|
|
65
65
|
```
|
66
66
|
:replies:
|
67
67
|
- :author: lucbloom
|
68
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gevj26a
|
68
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gevj26a
|
69
69
|
:body: |-
|
70
70
|
Haha, subtracting 2 sets to find the one missing. So wasteful, so 2020. Love it.
|
71
71
|
|
72
72
|
Doesn't Ruby have a "get first element" function for sets? Like start an iteration and immediately `break`?
|
73
73
|
:replies:
|
74
74
|
- :author: purplepinapples
|
75
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gevk6xm
|
75
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gevk6xm
|
76
76
|
:body: |-
|
77
77
|
> "get first element" for sets
|
78
78
|
|
@@ -81,7 +81,7 @@
|
|
81
81
|
Under the hood, there obviously would be a "first element" in the underlying hash implementation, but it isn't an exposed function.
|
82
82
|
:replies: []
|
83
83
|
- :author: '442401'
|
84
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/getk65n
|
84
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/getk65n
|
85
85
|
:body: |-
|
86
86
|
# Ruby
|
87
87
|
|
@@ -96,7 +96,7 @@
|
|
96
96
|
```
|
97
97
|
:replies: []
|
98
98
|
- :author: ni3t
|
99
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/ges0n5d
|
99
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/ges0n5d
|
100
100
|
:body: |-
|
101
101
|
# Ruby
|
102
102
|
|
@@ -114,7 +114,7 @@
|
|
114
114
|
```
|
115
115
|
:replies: []
|
116
116
|
- :author: tckmn
|
117
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoa6oq
|
117
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoa6oq
|
118
118
|
:body: |-
|
119
119
|
ruby, 1/10
|
120
120
|
|
@@ -139,11 +139,11 @@
|
|
139
139
|
```
|
140
140
|
:replies:
|
141
141
|
- :author: Sharparam
|
142
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geobld3
|
142
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geobld3
|
143
143
|
:body: That's an amazing way to construct the seat numbers! I ended up [doing it a more verbose way](https://github.com/Sharparam/advent-of-code/blob/master/2020/day5/solution.rb).
|
144
144
|
:replies:
|
145
145
|
- :author: Forbizzle
|
146
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoce4b
|
146
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoce4b
|
147
147
|
:body: |-
|
148
148
|
Yeah it's interesting. I immediately recognized that the binary search instructions were just binary numbers. And rather than doing a search I could just use turn them into numbers.
|
149
149
|
|
@@ -152,11 +152,11 @@
|
|
152
152
|
I also learned about the .tr method in ruby. Having instead done a chain of 4 gsubs.
|
153
153
|
:replies: []
|
154
154
|
- :author: wace001
|
155
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geom92w
|
155
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geom92w
|
156
156
|
:body: Impressive. Good job! How does tr work?
|
157
157
|
:replies:
|
158
158
|
- :author: tckmn
|
159
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/georn8k
|
159
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/georn8k
|
160
160
|
:body: |-
|
161
161
|
it's the same as `tr` in bash (stands for "translate") -- it'll replace characters in the first string with corresponding characters in the second string
|
162
162
|
|
@@ -166,7 +166,7 @@
|
|
166
166
|
```
|
167
167
|
:replies: []
|
168
168
|
- :author: Ryuujinx
|
169
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geqgw2y
|
169
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geqgw2y
|
170
170
|
:body: |-
|
171
171
|
# Ruby
|
172
172
|
|
@@ -209,7 +209,7 @@
|
|
209
209
|
Part 2 was mostly the same, I just shoved it in an array sorted it and then checked if current id -2 = last id
|
210
210
|
:replies: []
|
211
211
|
- :author: Krakhan
|
212
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geok8ss
|
212
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geok8ss
|
213
213
|
:body: |-
|
214
214
|
**Ruby**
|
215
215
|
|
@@ -230,11 +230,11 @@
|
|
230
230
|
```
|
231
231
|
:replies:
|
232
232
|
- :author: Scoobyben
|
233
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geop1ap
|
233
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geop1ap
|
234
234
|
:body: Neat approach to part 2!
|
235
235
|
:replies: []
|
236
236
|
- :author: wikipedia_text_bot
|
237
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geok9fu
|
237
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geok9fu
|
238
238
|
:body: |-
|
239
239
|
**[Arithmetic progression](https://en.wikipedia.org/wiki/Arithmetic%20progression)**
|
240
240
|
|
@@ -243,7 +243,7 @@
|
|
243
243
|
[About Me](https://www.reddit.com/user/wikipedia_text_bot/comments/jrn2mj/about_me/) - [Opt out](https://www.reddit.com/user/wikipedia_text_bot/comments/jrti43/opt_out_here/) - OP can reply !delete to delete - [Article of the day](https://redd.it/k6wsfi)
|
244
244
|
:replies: []
|
245
245
|
- :author: rkachowski
|
246
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep4x6g
|
246
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep4x6g
|
247
247
|
:body: |-
|
248
248
|
more elixir. realising that in part 2 you're not at the front or back must mean there exists a row with exactly 7 taken seats. so that was nice.
|
249
249
|
|
@@ -297,18 +297,18 @@
|
|
297
297
|
```
|
298
298
|
:replies:
|
299
299
|
- :author: Jedimastert
|
300
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep7wr6
|
300
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep7wr6
|
301
301
|
:body: |-
|
302
302
|
> var || []
|
303
303
|
|
304
304
|
fyi, this is called [lazy evaluation](https://www.wikiwand.com/en/Lazy_evaluation), and the concept can be applied much broader if you understand it correctly.
|
305
305
|
:replies:
|
306
306
|
- :author: rkachowski
|
307
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep9tt1
|
307
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep9tt1
|
308
308
|
:body: where's the laziness? i understand it as a null coalescing operation
|
309
309
|
:replies:
|
310
310
|
- :author: Jedimastert
|
311
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gepfti8
|
311
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gepfti8
|
312
312
|
:body: |-
|
313
313
|
The idea is that the `[]` was never reached because the `||` operator did it's job
|
314
314
|
|
@@ -323,11 +323,11 @@
|
|
323
323
|
Does that explain things better?
|
324
324
|
:replies:
|
325
325
|
- :author: rkachowski
|
326
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gephazd
|
326
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gephazd
|
327
327
|
:body: awesome, thanks!
|
328
328
|
:replies: []
|
329
329
|
- :author: petercooper
|
330
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep808u
|
330
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep808u
|
331
331
|
:body: |-
|
332
332
|
**Ruby**
|
333
333
|
|
@@ -359,7 +359,7 @@
|
|
359
359
|
```
|
360
360
|
:replies: []
|
361
361
|
- :author: zB0hs
|
362
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gepjlmd
|
362
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gepjlmd
|
363
363
|
:body: |-
|
364
364
|
Here's my Ruby solution to Part 2. Convert the seat codes to binary to get the integer values and then find the missing seat with array subtraction!
|
365
365
|
|
@@ -370,7 +370,7 @@
|
|
370
370
|
```
|
371
371
|
:replies:
|
372
372
|
- :author: steerio
|
373
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geplrkr
|
373
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geplrkr
|
374
374
|
:body: |-
|
375
375
|
Another Ruby one (hijacking your comment to have a Ruby subthread):
|
376
376
|
|
@@ -381,7 +381,7 @@
|
|
381
381
|
```
|
382
382
|
:replies: []
|
383
383
|
- :author: ttapu
|
384
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoi8x3
|
384
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoi8x3
|
385
385
|
:body: |-
|
386
386
|
ruby
|
387
387
|
|
@@ -406,7 +406,7 @@
|
|
406
406
|
```
|
407
407
|
:replies: []
|
408
408
|
- :author: CodeIsTheEnd
|
409
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoqhev
|
409
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoqhev
|
410
410
|
:body: |-
|
411
411
|
**Ruby:** 6:43/13:07, 526/975
|
412
412
|
|
@@ -415,7 +415,7 @@
|
|
415
415
|
I totally misread what to do with the two values we got (I did `row * seat` first instead of `row * 8 + seat`). Did anyone else find the instructions for Part 2 confusing? At first I thought the seat ids would be sparse and that there would just be two seat ids two apart (e.g., seat ids would be like 5, 32, 235, 712, 714, 832 and so your seat would be 713).
|
416
416
|
:replies: []
|
417
417
|
- :author: frontpageminus
|
418
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoqwzg
|
418
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geoqwzg
|
419
419
|
:body: |-
|
420
420
|
Ruby - 18169/17128. I fell asleep before the puzzle was released ¯\_(ツ)\_/¯
|
421
421
|
|
@@ -450,7 +450,7 @@
|
|
450
450
|
```
|
451
451
|
:replies: []
|
452
452
|
- :author: shandley256
|
453
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/georjrf
|
453
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/georjrf
|
454
454
|
:body: |-
|
455
455
|
# Day 5 in Ruby
|
456
456
|
|
@@ -471,7 +471,7 @@
|
|
471
471
|
This outputs both answers.
|
472
472
|
:replies: []
|
473
473
|
- :author: jeffers0n
|
474
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geozly9
|
474
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geozly9
|
475
475
|
:body: |-
|
476
476
|
My solution in Ruby.
|
477
477
|
|
@@ -512,15 +512,15 @@
|
|
512
512
|
```
|
513
513
|
:replies:
|
514
514
|
- :author: el_daniero
|
515
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep0mj4
|
515
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep0mj4
|
516
516
|
:body: 'Pro tip: Whenever you''re just trying to pull some information out of some strings, with very high probability, [there''s a method for that](https://ruby-doc.org/core-2.7.2/String.html). The trick to Ruby mastery is to remember exactly _which_ methods – and what the hell they are called ;) (For this one [I](https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geozxna?utm_source=share&utm_medium=web2x&context=3) used `scan`, `tr` and `to_i`.) The same notion for arrays; You rarely want to push stuff yourself and roll your own loop, much less nested loops.'
|
517
517
|
:replies:
|
518
518
|
- :author: jeffers0n
|
519
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep301z
|
519
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep301z
|
520
520
|
:body: Thanks. I'm still learning Ruby so I know there are tons of methods that aren't even on my radar.
|
521
521
|
:replies: []
|
522
522
|
- :author: el_daniero
|
523
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geozxna
|
523
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/geozxna
|
524
524
|
:body: |-
|
525
525
|
# Ruby
|
526
526
|
|
@@ -547,7 +547,7 @@
|
|
547
547
|
```
|
548
548
|
:replies:
|
549
549
|
- :author: el_daniero
|
550
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep44im
|
550
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep44im
|
551
551
|
:body: |-
|
552
552
|
d'oh, just realized that there are three digits of the `LR` part, which means that the `FB` part is shifted by 3 (== multiplied by 8), so there is no need to handle the two parts spearately. The `scan`/`map` part can then be simplified to
|
553
553
|
|
@@ -557,7 +557,7 @@
|
|
557
557
|
```
|
558
558
|
:replies: []
|
559
559
|
- :author: "[deleted]"
|
560
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep913x
|
560
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gep913x
|
561
561
|
:body: |-
|
562
562
|
Ruby, similar to some other submissions:
|
563
563
|
|
@@ -570,7 +570,7 @@
|
|
570
570
|
```
|
571
571
|
:replies: []
|
572
572
|
- :author: maccosmo
|
573
|
-
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gepe19m
|
573
|
+
:url: https://www.reddit.com/r/adventofcode/comments/k71h6r/2020_day_05_solutions/gepe19m
|
574
574
|
:body: |-
|
575
575
|
One liner for both cases in Ruby with help of /u/Redofab and /u/veit\_dev:
|
576
576
|
|