Skip to content

Instantly share code, notes, and snippets.

View eugene70's full-sized avatar

Eugene Kim eugene70

View GitHub Profile
package aoc2022
object Day04:
private type InputType = Seq[String]
@main def runDay04(): Unit =
solve(testInput, input, ready, part1, part2)
private def ready(input: String): InputType =
input
package aoc2022
object Day03:
private type InputType = Seq[String]
@main def runDay03(): Unit =
solve(testInput, input, ready, part1, part2)
private def ready(input: String): InputType =
input
package aoc2022
object Day02:
private type InputType = Seq[Seq[String]]
@main def runDay02: Unit =
val testData = time("testReady", () => ready(testInput))
time("testPart1", () => part1(testData)) // should be 15
time("testPart2", () => part2(testData)) // should be 12
package aoc2021
import scala.annotation.tailrec
import scala.collection.mutable
object Day15:
type InputType = Seq[Seq[Int]]
@main def runDay15: Unit =
val testData = time("testReady", () => ready(testInput))
package aoc2021
import java.util
import scala.annotation.tailrec
import scala.collection.mutable
object Day14:
type InputType = (Seq[Char], Instruction)
type Instruction = Map[(Char, Char), Char]
package aoc2021
import scala.annotation.tailrec
object Day13:
type InputType = (Set[Dot], Seq[Fold])
case class Dot(x: Int, y: Int)
case class Fold(dir: FoldDir, pos: Int)
enum FoldDir:
package aoc2021
import scala.::
import scala.annotation.tailrec
import scala.collection.mutable
object Day09:
type InputType = Seq[Seq[Int]]
@main def runDay09: Unit =
package aoc2021
object Day08:
type InputType = Seq[Display]
/**
* 0 6
* 1 2 *
* 2 5
* 3 5
package aoc2021
object Day07:
type InputType = Seq[Int]
@main def runDay07(): Unit =
val testData = time("testReady", () => ready(testInput))
time("testPart1", () => part1(testData)) // should be 37
time("testPart2", () => part2(testData)) // should be 168
package aoc2021
object Day06:
type InputType = Seq[Int]
@main def runDay06(): Unit =
val testData = time("testReady", () => ready(testInput))
time("testPart1", () => part1(testData)) // should be 5934
time("testPart2", () => part2(testData)) // should be 26984457539