My solutions to Advent of Code 2023. This year, I'm going to try doing the challenges mainly in Zig and Rust
git clone git@github.com:edmBernard/AoC-2023.git
cd AoC-2023
zig build -Drelease
cargo build --release
./zig-out/bin/day01 data/day01.txt
./target/release/day01 data/day01.txt
Day | Solution | Description | Tips |
---|---|---|---|
Day01 puzzle | Zig Rust C++ | Find digit and literal digit | Store only useful digits, do the search in both direction, digit name can overlap |
Day02 puzzle | Zig | Find number of colored cube | |
Day03 puzzle | Zig | Find engine part and gear | nothing just hard |
Day04 puzzle | Zig | Scratch card | |
Day05 puzzle | Zig | Seeds planting | directly work on range |
Day06 puzzle | Zig | Boat race | |
Day07 puzzle | Zig | Poker | |
Day08 puzzle | Zig | Graph | inputs are particular enough to use LCM |
Day09 puzzle | Zig | time serie prediction | |
Day11 puzzle | Zig | Galaxy and universe expansion | work directly on galaxy coordinate |
Day12 puzzle | Zig | Count pattern matching | recursive and memoization |
In Zig
Zig day01 in 64.88 us : part1=54304 part2=54418
Zig day02 in 44.50 us : part1=2348 part2=76008
Zig day03 in 117.06 us : part1=527364 part2=79026871
Zig day04 in 82.68 us : part1=21558 part2=10425665
Zig day05 in 50.07 us : part1=600279879 part2=20191102
Zig day06 in 8.45 us : part1=114400 part2=21039729
Zig day07 in 1964.08 us : part1=250946742 part2=251824095
Zig day08 in 3258.56 us : part1=22357 part2=10371555451871
Zig day09 in 106.85 us : part1=1731106378 part2=1087
...
Zig day11 in 148.00 us : part1=9599070 part2=842645913794
Zig day12 in 5256.85 us : part1=6949 part2=51456609952403
Zig day13 in 9522.00 us : part1=33728 part2=0
In Rust
Rust day01 in 66.89 us : part1=54304 part2=54418
In C++
C++ day01 in 49.191 us : part1=54304 part2=54418
- Zig : 0.13.0
- Rust : rustc 1.76.0
- C++ : clang 15.0.0