Advent of Code is an annual event where users are given a series of programming challenges to solve, all courtesy of Eric Wastl. I just want to use multiple languages and have fun solving it. My goal for all years is 30
/50 stars.
By the way, the difficulty is how I feel. It's not a real metric. I'm just a beginner programmer. How I consider it:
- Easy: simple and straightforward, usually brute-force with no optimization.
- Medium: difficulties in parsing, solving, etc. Usually requires some optimization.
- Hard: requires more knowledge, more optimization, and realizing the core of the problem. Usually a brute-force solution won't work.
- Very Hard: requires some obscure algorithmic knowledge. I probably won't be able to do this.
- Brutal: even if I know the solution, I probably can't even implement it.
For this year, I'd like to be able to use multiple languages to solve the problems. Probably won't reach 25/25 languages for all, but a girl can dream (the dream is no more).
Day | Language | Stars | Solution | Difficulty (Part 1) | Difficulty (Part 2) | Notes |
---|---|---|---|---|---|---|
1 | Objective-C | ⭐️⭐️ | Day 1 | Easy | Hard | |
2 | Rust | ⭐️⭐️ | Day 2 | Easy | Easy | |
3 | Go | ⭐️⭐️ | Day 3 | Hard | Hard | |
4 | Ruby | ⭐️⭐️ | Day 4 | Easy | Medium | |
5 | JavaScript | ⭐️⭐️ | Day 5 | Medium | Hard | |
6 | Haskell | ⭐️⭐️ | Day 6 | Easy | Easy | |
7 | Clojure | ⭐️⭐️ | Day 7 | Easy | Medium | |
8 | Elixir | ⭐️⭐️ | Day 8 | Easy | Medium | |
9 | Julia | ⭐️⭐️ | Day 9 | Easy | Easy | |
10 | Swift | ⭐️⭐️ | Day 10 | Medium | Hard | |
11 | Perl | ⭐️⭐️ | Day 11 | Medium | Medium | |
12 | Lua | ⭐️⭐️ | Day 12 | Hard | Hard | |
13 | Dyalog APL | ⭐️⭐️ | Day 13 | Medium | Medium | |
14 | Scala | ⭐️⭐️ | Day 14 | Medium | Hard | |
15 | C | ⭐️⭐️ | Day 15 | Easy | Easy | |
16 | Java | ⭐️⭐️ | Day 16 | Easy | Easy | |
17 | Python | ⭐️⭐️ | Day 17 | Hard | Hard | |
18 | Kotlin | ⭐️⭐️ | Day 18 | Medium | Hard | |
19 | TypeScript | ⭐️⭐️ | Day 19 | Medium | Hard | |
20 | Python | ⭐️⭐️ | Day 20 | Medium | Hard | (1) |
21 | Python | ⭐️⭐️ | Day 21 | Medium | Very Hard | (2) |
Total Stars: 42⭐️ (GOAL ACHIEVED! :D)
Notes:
- I caved and used Python. I also looked up the key on Reddit, to learn that the input was crafted meticulously for a few assumptions to be true.
- I would not have even thought of parities. I tried to memoize, but it's infinite so not a lot can be memoized. I also tried to interpolate a quadratic solution, but that does not give enough precise answer (about 100k~ in difference, for the example, yielding about ~16100000 for the x=5000). I also tried to calibrate the quadratic solution, but nothing came up precise enough. Looked up hints and solutions on Reddit for this one.
Using APL will expand and extend the range of mental models that you use to solve problems, but beware: once you are hooked on APL, there is a real risk that you will no longer accept the limitations of “traditional” programming languages.
- Mastering Dyalog APL
Well, he's right. I'm addicted. I now reject the verbose stuff of C++. My brain only thinks in arrays now, I'm doomed. Same thing: dialect of Dyalog APL version 18.2.
At first, I want to do this in a new array-oriented language Uiua, but it's being updated a lot, and it's not yet stable. So I'll wait until it is.
Day | Stars | Solution | Difficulty (Part 1) | Difficulty (Part 2) | Notes |
---|---|---|---|---|---|
1 | ⭐️⭐️ | Day 1 | Easy | Easy | |
2 | ⭐️⭐️ | Day 2 | Easy | Easy | |
3 | ⭐️⭐️ | Day 3 | Easy | Easy | |
4 | ⭐️⭐️ | Day 4 | Easy | Easy | |
5 | ⭐️⭐️ | Day 5 | Easy | Easy | (1) |
6 | ⭐️⭐️ | Day 6 | Easy | Easy | |
7 | ⭐️⭐️ | Day 7 | Easy | Easy | |
8 | ⭐️⭐️ | Day 8 | Easy | Easy | |
9 | ⭐️⭐️ | Day 9 | Easy | Medium |
Notes:
- MD5 implementation is required.
I want to solve everything in Dyalog APL in this year. The goal is also getting fluent, and becoming comfortable with how APL works.
- Dyalog APL 18.2
- Index Origin: 1
Day | Stars | Solution | Difficulty (Part 1) | Difficulty (Part 2) | Notes |
---|---|---|---|---|---|
1 | ⭐️⭐️ | Day 1 | Easy | Easy | |
2 | ⭐️⭐️ | Day 2 | Easy | Easy | |
3 | ⭐️⭐️ | Day 3 | Medium | Medium | |
4 | ⭐️⭐️ | Day 4 | Easy | Easy | (1) |
5 | ⭐️⭐️ | Day 5 | Easy | Medium | |
6 | ⭐️⭐️ | Day 6 | Easy | Easy | |
7 | ⭐️⭐️ | Day 7 | Easy | Easy | (2) |
8 | ⭐️⭐️ | Day 8 | Easy | Easy | |
9 | ⭐️⭐️ | Day 9 | Medium | Medium | (3) |
10 | ⭐️⭐️ | Day 10 | Easy | Easy | |
11 | ⭐️⭐️ | Day 11 | Medium | Medium | |
12 | ⭐️⭐️ | Day 12 | Easy | Medium | (4) |
13 | ⭐️⭐️ | Day 13 | Medium | Medium | (5) |
14 | ⭐️⭐️ | Day 14 | Easy | Medium | |
15 | ⭐️⭐️ | Day 15 | Medium | Medium | |
16 | ⭐️⭐️ | Day 16 | Easy | Easy | |
17 | ⭐️⭐️ | Day 17 | Easy | Easy | |
18 | ⭐️⭐️ | Day 18 | Easy | Easy | |
19 | ⭐️⭐️ | Day 19 | Medium | Hard | (6) |
20 | ⭐️⭐️ | Day 20 | Easy | Easy | |
21 | ⭐️⭐️ | Day 21 | Easy | Easy | |
22 | ⭐️⭐️ | Day 22 | Hard | Hard | |
23 | ⭐️⭐️ | Day 23 | Easy | Easy | |
24 | ⭐️⭐️ | Day 24 | Medium | Medium | (7) |
25 | ⭐️⭐️ | Day 25 | Easy | Easy |
I brute-forced a lot, wow.
Notes:
- Requires an MD5 implementation. I'm not doing that in APL.
- Removed the assignment line in the input file. Don't know if that's considered cheating or not.
- Learned that this is a version of TSP. Used brute-force.
- Part 2's code had a portion copied from xpqz.
- 9! permutations of TSP. Brute-forced.
- Read hints on Reddit for this day. (Still baffled how they notice that)
- This feels cheated because I only looked for the first group's presents. If there are any ways that with those first group presents, the rest can't be divided evenly, this would be wrong.