Skip to content

AndriiSonsiadlo/advent-of-code-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code - C++ Solutions

Welcome to my repository of Advent of Code solutions written in C++. This repository contains my attempts at solving the annual programming challenge series.

About Advent of Code

Advent of Code is an annual event featuring a series of programming puzzles released daily from December 1st through December 12th. Each day presents two related problems that increase in difficulty as the event progresses. Participants earn one star for solving each puzzle.

Repository Structure

Solutions are organized by year and day:

advent-of-code-cpp/
├── 2025/
│   ├── day_1/
│   │   ├── README.md      (problem description)
│   │   ├── main.cpp       (solution)
│   │   └── input.txt      (puzzle input)
│   ├── day_2/
│   ├── day_3/
│   └── ...
├── .gitignore
├── LICENSE
└── README.md (this file)

Building and Running

Prerequisites

  • C++17 or later
  • A C++ compiler (g++, clang, MSVC, etc.)

Compilation

For individual solutions:

cd 2025/day_1
g++ -std=c++17 -O2 main.cpp -o solution
./solution

Most solutions read from an input.txt file in the same directory.

Solution Highlights

2025

  • Day 1 - Secret Entrance: Safe dial rotation puzzle with two different counting methods

    • Part 1: Count times dial lands on 0 after rotations
    • Part 2: Count all times dial passes through 0, including during rotations
  • Day 2 - Gift Shop: Invalid product ID detection

    • Part 1: Find IDs that are exact digit pattern repetitions (exactly 2 times)
    • Part 2: Find IDs that are digit pattern repetitions (2+ times)
  • Day 3 - Lobby: Battery joltage selection from digit banks

    • Part 1: Find maximum joltage using 2 digits per bank
    • Part 2: Find maximum joltage using 12 digits per bank

Approach

Each solution prioritizes:

  • Correctness - Solving the puzzle accurately
  • Efficiency - Reasonable performance, especially for large inputs
  • Readability - Clear code structure with meaningful variable names

Where appropriate, solutions include optimized implementations (e.g., mathematical approaches over brute force).

Contributing

This is a personal practice repository, but feel free to fork it or use it as reference for your own solutions!

License

This repository is for educational purposes. Advent of Code is created by Eric Wastl.

For more information, visit adventofcode.com.

About

This repository contains my daily solutions for Advent of Code programming challenges.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages