Solutions for Advent of Code 2022
This is a repository containing solutions for Advent of Code Challenge.
It is held once in every year for 25 days from 1st to 25th December
We need to solve two problems each day. For solving we are awarded with stars.
The challenge is unique compared to other competitive programming challenges.
The solutions are written in Rust a high performant language.
To get each day's solution, clone this repo: https://github.com/akhildevelops/AdventofCode2022 and run respective command as shown below
Day | Story | Solution | Part1 | Part2 | command to run | challenge level | What I learnt |
---|---|---|---|---|---|---|---|
Dec-1 | Calorie Counting | Day1 🚢 | ⭐ | ⭐ | cargo solve day1 |
🧗 | Rust's Result methods |
Dec-2 | Rock Paper Scissors | Day2 🚢 | ⭐ | ⭐ | cargo solve day2 |
🧗 🧗 | Mental Map scenarios/states to integers |
Dec-3 | Rucksack Reorganization | Day3 🚢 | ⭐ | ⭐ | cargo solve day3 |
🧗🧗 | Sets to find common elements |
Dec-4 | Camp Cleanup | Day4 🚢 | ⭐ | ⭐ | cargo solve day4 |
🧗🧗 | Check if an element is present in the boundaries. |
Dec-5 | Supply Stacks | Day5 🚢 | ⭐ | ⭐ | cargo solve day5 |
🧗🧗🧗 | Parse text into columns and borrow checker |
Dec-6 | Tuning Trouble | Day6 🚢 | ⭐ | ⭐ | cargo solve day6 |
🧗 | Find non repeating chars in a string. |
Dec-7 | No Space Left On Device | ||||||
Dec-8 | Treetop Tree House | Day8 🚢 | ⭐ | ⭐ | cargo solve day8 |
🧗🧗 | Grid type data structures + create references, not to be owned by closures |
Dec-9 | Rope Bridge | Day9 🚢 | ⭐ | ⭐ | cargo solve day9 |
🧗🧗 | Hashets and iterators |
Dec-10 | Cathode-Ray Tube | Day10 🚢 | ⭐ | ⭐ | cargo solve day10 |
🧗*1.5 | Code comprehension >>> Code optimization |
To create a new project for a particular day run cargo setup <name>
Ex: To setup day15 run: cargo setup day15
It creates below structure:
src/
├── bin/
│ ├── ...
│ ├── day15.rs // day15.rs binary file is created that prints part1 and part2 solutions.
│ └── ...
├── lib.rs // Get's updated with day15 module for importing into binary.
├── ...
├── day15 // day15 module is created with input.txt for puzzle input, Readme.md for any Notes and mod.rs containing logic./
│ ├── input.txt
│ ├── mod.rs
│ └── Readme.md
└── ...