This repository contains my solutions to the Advent of Code 2023 challenges, implemented in Rust. Each day presents unique algorithmic problems that explore different programming concepts and data structures.
Advent of Code is an annual programming event created by Eric Wastl. It consists of 25 daily programming puzzles released each December, designed to be solvable with any programming language. The puzzles typically increase in difficulty as the days progress.
Solutions are organized by day in the src/bin
directory. Each day contains:
- Source code for the solution
- A README explaining the problem and approach
- Input data (if applicable)
To run a specific day's solution:
cargo run --bin dayX
Where X is the day number (1-25).
Day 1 : Digit Extraction
- Extract first and last digits from text lines including spelled-out numbers.
- Key concepts: String parsing, regular expressions, iterators
Day 2 : Cube Conundrum
- Determine the feasibility of games given bag constraints.
- Key concepts: Data modeling, parsing, filtering
Day 3 : Gear Ratios
- Identify numbers adjacent to symbols in a grid.
- Key concepts: Grid processing, adjacency detection, 2D→1D mapping
Day 4 : Scratchcards
- Calculate points from matching numbers and track card copies.
- Key concepts: Set operations, hashmap-based counting
Day 5 : If You Give A Seed A Fertilizer
- Transform values through a series of range mappings.
- Key concepts: Range operations, transformation pipelines
Day 6: Wait For It
- Determine winning strategies for a toy boat race.
- Key concepts: Quadratic equations, mathematical optimization
Day 7: Camel Cards
- Rank poker-like hands with custom rules.
- Key concepts: Classification algorithms, custom sorting
Day 8: Haunted Wasteland
- Navigate a network following left/right instructions.
- Key concepts: Graph traversal, cycle detection, LCM
Day 9: Mirage Maintenance
- Predict sequence values by analyzing differences.
- Key concepts: Recursive algorithms, sequence analysis
Day 10: Pipe Maze
- Find the longest path in a loop of connected pipes.
- Key concepts: Graph traversal, flood fill, even-odd rule
Day 11: Cosmic Expansion
- Calculate distances between points after space expansion.
- Key concepts: Coordinate transformation, Manhattan distance
Day 12: Hot Springs
- Count valid arrangements of springs with constraints.
- Key concepts: Dynamic programming, memoization
Day 13: Point of Incidence
- Find reflection lines in patterns with imperfections.
- Key concepts: Pattern recognition, symmetry detection
Day 14: Parabolic Reflector Dish
- Calculate load on a platform after tilting rocks.
- Key concepts: Grid simulation, cycle detection
Day 15: Lens Library
- Implement a hash-based focusing system.
- Key concepts: Custom hash functions, linked lists
Day 16: The Floor Will Be Lava
- Track beam paths through mirrors and splitters.
- Key concepts: Direction-based simulation, cycle detection
Day 17: Clumsy Crucible
- Find path with minimal heat loss with directional constraints.
- Key concepts: Dijkstra's algorithm, state representation
Day 18: Lavaduct Lagoon
- Calculate the area enclosed by a trench.
- Key concepts: Polygon area calculation, Shoelace formula
Day 19: Aplenty
- Process parts through a workflow of conditional rules.
- Key concepts: Rule processing, range partitioning
- Rust (1.65 or newer recommended)
- Clone this repository
git clone https://github.com/yourusername/advent2023.git
cd advent2023
- Build the project
cargo build
- Run a specific day
cargo run --bin day1
- Thanks to Eric Wastl for creating Advent of Code
- The Rust community for their excellent documentation and support
This project is licensed under the MIT License - see the LICENSE file for details.