Find all the solutions to the Advent of Code 2025 written in Kotlin and organized by day with the respective inputs in the resources folder.
The Part 2 of Day9 was interesting for learning about:
- Coordinate Compression. An inspiring trick for transforming largely sparse multidimensional (i.e. 2D) arrays to more compact representations!
- Prefix Sum of 2D Arrays A powerful technique to compute quickly the sum of elements in any sub-matrix, through simple math operations!
The part 2 of Day10 felt like a trip back to university, specifically to the "Ricerca Operativa", where I learned how to solve Linear Programming problems: solving a system of linear equations under integrality constraints while minimizing an objective function.
Along the way, I discovered oj! Algorithms, a powerful Java/Kotlin library for mathematical optimization and numerical computing. Definitely a must-know tool for anyone dealing with optimization, linear algebra, or decision problems. It has been crucial setting an appropriate precision and scale to obtain the correct result: ExpressionsBasedModel.options -> Options.solution -> NumberContext.
Day12 taught me that before starting overthinking a complex solution for a complex problem, is better to make some trivial checks and try to cut out some chunks of work!
Sometimes (like in this case), after removing the trivial cases, there might be nothing left to worry about! :)
This project provides the script PrepareWorkTask.kt which is handy to get started with the implementation for the solution of a new Day. It can be used with the command:
./gradlew PrepareWorkTask -Pday="day26" -Ppkg="edu.adarko22"The script generates the Day26.kt file in the kotlin sources in the solutions module, with the predefined code
structure.
This project provides also the script GenerateJar.kt to generate a runnable Jar for all or a specific file:
./gradlew generateJar -Pall=true./gradlew generateJar -PmainFile=DayX.kt
The jar files will be available in the build/libs/days/ folder.