This Julia package contains my solutions for Advent of Code 2024.
Day | Problem | Problem type | Algorithms / Data structures | Time | Allocated memory | Source |
---|---|---|---|---|---|---|
1 | ✅ | Array manipulation | Sorting | 459.477 μs | 461.83 KiB | ✅ |
2 | ✅ | Array manipulation | Brute Force, Linear Search | 2.070 ms | 3.64 MiB | ✅ |
3 | ✅ | String Parsing | Regular Expressions, Sliding Window | 470.249 μs | 376.73 KiB | ✅ |
4 | ✅ | Grid | Pattern Matching | 1.798 ms | 3.06 MiB | ✅ |
5 | ✅ | Graph | Topological Sorting | 2.104 ms | 1.26 MiB | ✅ |
6 | ✅ | Simulation | Graph Traversal, Cycle Detection | 549.253 ms | 50.91 MiB | ✅ |
7 | ✅ | Expression Evaluation | Recursion | 30.710 ms | 1.53 MiB | ✅ |
8 | ✅ | Grid | Line Tracing, Grid Traversal | 94.050 μs | 46.30 KiB | ✅ |
9 | ✅ | Array manipulation | Greedy | 28.311 ms | 9.58 MiB | ✅ |
10 | ✅ | Grid | Recursion, DFS | 578.868 μs | 633.67 KiB | ✅ |
11 | ✅ | Simulation | Dynamic Programming, Memoization | 15.667 ms | 12.60 MiB | ✅ |
12 | ✅ | Grid | DFS | 4.995 ms | 5.97 MiB | ✅ |
13 | ✅ | Linear Algebra | Linear Systems | 3.101 ms | 1.15 MiB | ✅ |
14 | ✅ | Simulation | Brute Force | 26.443 ms | 274.98 KiB | ✅ |
15 | ✅ | Simulation | Flood Fill, BFS | 1.944 ms | 3.16 MiB | ✅ |
16 | ✅ | Path Finding, Grid | Dijkstra's Algorithm, BFS, Priority Queue, Deque | 20.822 ms | 9.21 MiB | ✅ |
17 | ✅ | Virtual Machine | Simulation, Reverse Engineering, Backtracking | 6.921 ms | 706.30 KiB | ✅ |
18 | ✅ | Path Finding | BFS, Binary Search | 3.007 ms | 5.51 MiB | ✅ |
19 | ✅ | Strings | Backtracking, Memoization, Recursion | 57.908 ms | 3.41 MiB | ✅ |
20 | ✅ | Path Finding | BFS, Grid Traversal | 49.638 ms | 701.11 KiB | ✅ |
21 | ✅ | Path Finding, Simulation | Memoization, Graph Traversal, Deque | 296.609 μs | 78.89 KiB | ✅ |
22 | ✅ | Simulation | Bitwise operations, Hashing, Memoization | 25.522 ms | 1.18 MiB | ✅ |
23 | ✅ | Graph | DFS, Clique Detection, Adjacency Matrix | 4.197 ms | 3.82 MiB | ✅ |
24 | ✅ | Logic | Topological Sorting, Bitwise Operations | 2.497 s | 4.82 MiB | ✅ |
25 | ✅ | Matching | Brute Force | 2.178 ms | 3.47 MiB | ✅ |
The benchmarks have been measured on this machine:
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
Threads: 1 on 8 virtual cores
Make sure you have Julia 1.9 or newer installed on your system.
Start Julia and enter the package REPL by typing ]
. Create a new
environment:
(@v1.8) pkg> activate aoc
Install AdventOfCode2024.jl
:
(aoc) pkg> add https://github.com/goggle/AdventOfCode2024.jl
Go back to the Julia REPL by pushing the backspace
key.
First, activate the package:
julia> using AdventOfCode2024
Each puzzle can now be run with dayXY()
:
julia> day01()
2-element Vector{Int64}:
1590491
22588371
This will use my personal input. If you want to use another input, provide it
to the dayXY
method as a string. You can also use the readInput
method
to read your input from a text file:
julia> input = readInput("/path/to/input.txt")
julia> AdventOfCode2024.Day01.day01(input)
2-element Vector{Int64}:
1590491
22588371