Welcome to my Advent of Code 2024 repository! This repository contains my solutions for the Advent of Code puzzles, organized by day. Each day, two puzzles are released, and the goal is to solve them to collect stars ⭐.
I chose Python for solving these puzzles due to several reasons:
- Ease of Use: Python’s syntax is simple and intuitive, allowing me to write clean and easy-to-understand code.
- Rich Libraries: Python has a vast array of built-in libraries and data structures, which makes it easy to implement solutions for common problems.
- Community Support: Python has a large, supportive community, providing a wealth of resources for problem-solving, debugging, and learning.
- Quick Prototyping: Python allows me to quickly test and refine solutions, which is ideal for the fast-paced challenges of Advent of Code.
Currently, the repository contains solutions for Day 1, Day 2 and Day 3, with the following structure:
.
├── Day 1
│ ├── input.txt # The actual input provided by Advent of Code
│ ├── test.txt # Example input provided in the problem description
│ ├── 1.py # Solution for the first puzzle
│ ├── 2.py # Solution for the second puzzle
│ └── problem.md # The problem description in Markdown format
├── Day 2
│ ├── input.txt # The actual input provided by Advent of Code
│ ├── test.txt # Example input provided in the problem description
│ ├── 1.py # Solution for the first puzzle
│ ├── 2.py # Solution for the second puzzle
│ └── problem.md # The problem description in Markdown format
├── Day 3
│ ├── input.txt # The actual input provided by Advent of Code
│ ├── test.txt # Example input provided in the problem description
│ ├── 1.py # Solution for the first puzzle
│ ├── 2.py # Solution for the second puzzle
│ └── problem.md # The problem description in Markdown format
└── README.md # This file
└── LICENSE # MIT LICENSE
-
Clone the repository:
git clone https://github.com/your-username/advent-of-code-2024.git cd advent-of-code-2024
-
Navigate to a day's folder (e.g., Day 1 or Day 2 or Day 3):
cd Day1 # or cd Day2 or cd Day3
-
Run the solution scripts:
- For the first puzzle:
python 1.py
- For the second puzzle:
python 2.py
- For the first puzzle:
- input.txt: The input data used to solve the puzzle, provided by Advent of Code.
- test.txt: Example input used for testing, based on the problem statement.
- 1.py: Python script containing the solution to the first puzzle.
- 2.py: Python script containing the solution to the second puzzle.
- problem.md: The problem description copied from the Advent of Code website for easy reference.
- Part 1: Calculate the total distance between two lists by pairing the smallest numbers.
- Part 2: Calculate a similarity score by counting occurrences of each number.
For detailed explanations and solutions, check the problem.md
file inside the Day1
directory.
- Part 1: Determine the number of safe reports where levels are either all increasing or all decreasing, with differences of 1 to 3 between adjacent levels.
- Part 2: Use the Problem Dampener, allowing one bad level to be ignored if removing it makes the report safe.
For detailed explanations and solutions, check the problem.md
file inside the Day2
directory.
- Part 1: Find and sum valid
mul(X,Y)
instructions from corrupted memory. - Part 2: Handle
do()
to enable anddon't()
to disablemul()
instructions, summing only the enabled results.
Check the problem.md
file in the Day3
directory for details.
- Leaderboard ID:
4310851-dea89f22
- Leaderboard Name: Advent of Code 2024
You can join the leaderboard using the private link provided in your Advent of Code profile.
Feel free to fork this repository and submit pull requests if you have improvements or alternative solutions!
If you have any questions, comments, or suggestions, feel free to reach out to me:
- Email: anish.k7644@gmail.com
- GitHub: @anish-107
This project is open-source and available under the MIT License.
Happy coding and Merry Christmas! 🎅🎄✨