A Kotlin template for Advent of Code, complete with a CLI.
- Click
Use this template
to create your own repository - Clone your new repository to your local machine
- Create a new configuration in IntelliJ IDEA and set
MainKt
as the main class- You may need to download any missing dependencies like OpenJDK or Kotlin, but IntelliJ IDEA will help you with this
- For each day, write your solution in the respective class in the
src/days
folder - Run your project and have fun!
The src/Utils.kt
file contains some helpful methods from JetBrains that you can use in your solutions.
- The
readFile(name: String)
function takes in a file name and returns a List. For example:var count = 0 val input = readFile("Day01").map { it.toInt() } for (i in 1 until input.size) { if (input[i] > input[i-1]) { count++ } }
- The
String.md5()
function is an extension method on the String class that transforms a string into a md5 hash. For example:if ("This is a test string".md5() == "c639efc1e98762233743a75e7798dd9c") { // This is true }