AdventOfCode2024.jl
Advent of Code 2024 in Julia
Install / Use
/learn @goggle/AdventOfCode2024.jlREADME
AdventOfCode2024
<!-- [](https://github.com/goggle/AdventOfCode2024.jl/actions?query=workflow%3ACI+branch%3Amain) --> <!-- [](https://codecov.io/github/goggle/AdventOfCode2024.jl?branch=main) -->This Julia package contains my solutions for Advent of Code 2024.
Overview
| Day | Problem | Problem type | Algorithms / Data structures | Time | Allocated memory | Source | |----:|:-------:|:-------------|:-----------------------------|-----:|-----------------:|:------:| | 1 | :white_check_mark: | Array manipulation | Sorting | 459.477 μs | 461.83 KiB | :white_check_mark: | | 2 | :white_check_mark: | Array manipulation | Brute Force, Linear Search | 2.070 ms | 3.64 MiB | :white_check_mark: | | 3 | :white_check_mark: | String Parsing | Regular Expressions, Sliding Window | 470.249 μs | 376.73 KiB | :white_check_mark: | | 4 | :white_check_mark: | Grid | Pattern Matching | 1.798 ms | 3.06 MiB | :white_check_mark: | | 5 | :white_check_mark: | Graph | Topological Sorting | 2.104 ms | 1.26 MiB | :white_check_mark: | | 6 | :white_check_mark: | Simulation | Graph Traversal, Cycle Detection | 89.797 ms | 38.00 MiB | :white_check_mark: | | 7 | :white_check_mark: | Expression Evaluation | Recursion | 30.710 ms | 1.53 MiB | :white_check_mark: | | 8 | :white_check_mark: | Grid | Line Tracing, Grid Traversal | 94.050 μs | 46.30 KiB | :white_check_mark: | | 9 | :white_check_mark: | Array manipulation | Greedy | 28.311 ms | 9.58 MiB | :white_check_mark: | | 10 | :white_check_mark: | Grid | Recursion, DFS | 578.868 μs | 633.67 KiB | :white_check_mark: | | 11 | :white_check_mark: | Simulation | Dynamic Programming, Memoization | 8.034 ms | 14.33 MiB | :white_check_mark: | | 12 | :white_check_mark: | Grid | DFS | 4.995 ms | 5.97 MiB | :white_check_mark: | | 13 | :white_check_mark: | Linear Algebra | Linear Systems | 3.101 ms | 1.15 MiB | :white_check_mark: | | 14 | :white_check_mark: | Simulation | Brute Force | 26.443 ms | 274.98 KiB | :white_check_mark: | | 15 | :white_check_mark: | Simulation | Flood Fill, BFS | 1.944 ms | 3.16 MiB | :white_check_mark: | | 16 | :white_check_mark: | Path Finding, Grid | Dijkstra's Algorithm, BFS, Priority Queue, Deque | 20.822 ms | 9.21 MiB | :white_check_mark: | | 17 | :white_check_mark: | Virtual Machine | Simulation, Reverse Engineering, Backtracking | 6.921 ms | 706.30 KiB | :white_check_mark: | | 18 | :white_check_mark: | Path Finding | BFS, Binary Search | 3.007 ms | 5.51 MiB | :white_check_mark: | | 19 | :white_check_mark: | Strings | Backtracking, Memoization, Recursion | 57.908 ms | 3.41 MiB | :white_check_mark: | | 20 | :white_check_mark: | Path Finding | BFS, Grid Traversal | 49.638 ms | 701.11 KiB| :white_check_mark: | | 21 | :white_check_mark: | Path Finding, Simulation | Memoization, Graph Traversal, Deque | 296.609 μs | 78.89 KiB | :white_check_mark: | | 22 | :white_check_mark: | Simulation | Bitwise operations, Hashing, Memoization | 25.522 ms | 1.18 MiB | :white_check_mark: | | 23 | :white_check_mark: | Graph | DFS, Clique Detection, Adjacency Matrix | 4.197 ms | 3.82 MiB | :white_check_mark: | | 24 | :white_check_mark: | Logic | Topological Sorting, Bitwise Operations | 310.021 ms | 2.16 MiB | :white_check_mark: | | 25 | :white_check_mark: | Matching | Brute Force | 2.178 ms | 3.47 MiB | :white_check_mark: |
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
Installation and Usage
Make sure you have Julia 1.9 or newer installed on your system.
Installation
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.
Usage
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
