A src/main/advent2022/Day03.kt => src/main/advent2022/Day03.kt +29 -0
@@ 0,0 1,29 @@
+package advent2022
+
+fun priority(item: Char): Int {
+ return if (item.isLowerCase()) item.code - 96 else item.code - 38
+}
+
+fun solve3a(rucksacks: List<String>): Int {
+ return rucksacks.sumOf { items ->
+ val (c1, c2) = items.chunked(items.count() / 2).map { it.toSet() }
+ val wrongItem = c1.intersect(c2)
+ check(wrongItem.count() == 1)
+ priority(wrongItem.first())
+ }
+}
+
+fun solve3b(rucksacks: List<String>): Int {
+ return rucksacks.chunked(3).sumOf { elfGroup ->
+ val (g1, g2, g3) = elfGroup.map { it.toSet() }
+ val badge = g1.intersect(g2).intersect(g3)
+ check(badge.count() == 1)
+ priority(badge.first())
+ }
+}
+
+fun main() {
+ val input = input("day03")
+ println(solve3a(input)) // 7980
+ println(solve3b(input)) // 2881
+}
A src/main/resources/advent2022/day03_input.txt => src/main/resources/advent2022/day03_input.txt +300 -0
@@ 0,0 1,300 @@
+GbccTtTSGGbgrcWBGGrdgTnVQnCmNpCJlNnNPVfClcnN
+vMzvZhzhwDLVmQnClwwNQp
+FRsZFzjQFsqRzRRjDZbdtTgdHBBWGrdBdHHs
+HCLTmbCLgzNBNPSSlT
+JJGMWRJMrrdwWWGjGWMLRGLjBzNQsBzPPfflzDPBsBffDrQz
+pwJdLMjdMddWjLtwZWMMwGtHhnvnCnhvqVFFZnvbgbqVCZ
+tvMCDCSVVvDDBQFRbqWMMsWgFWgc
+BLLPTpBmfLPrHLLfLsbhRqbzRRcRHgqssR
+dfdNLmPTdNZmZdZPfpmTJLPPSvQjtSGVwQSDJSjSwDQBVCGw
+wZWTWNFqzwZbWNpSgGMVMtTHsgGs
+nlnPnPvLQjzdtsjBHBMMGSHg
+LdnrrLnhRdLLmLDRPvmdQnJDJWNqcCqZJZqfFqfcfzcq
+vPTbfWggzvGVqjsVqV
+dDcJHZcZHmMFQQMshsjcRqVChjNtqh
+dDHJDmFnrJmQFnBdMdQHJdZZlWTTPPjTL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BHGGGSDvGDPHWBGdBbSvgWDNVMjLLRnmNmjPLNPNcRQVnjj
+tsGdTJdJtNllzjGRzm
+HZvvDLLWqbBBMRMRNjVhHRmn
+vZDCvqqgBDZZjbZDrWqBvpdpFpcdpCJcPTSJJtptpP
A src/test/advent2022/Day03KtTest.kt => src/test/advent2022/Day03KtTest.kt +25 -0
@@ 0,0 1,25 @@
+package advent2022
+
+import org.junit.jupiter.api.Test
+import kotlin.test.assertEquals
+
+internal class Day03KtTest {
+ val rucksacks = listOf(
+ "vJrwpWtwJgWrhcsFMMfFFhFp",
+ "jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL",
+ "PmmdzqPrVvPwwTWBwg",
+ "wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn",
+ "ttgJtRGJQctTZtZT",
+ "CrZsJsPPZsGzwwsLwLmpwMDw",
+ )
+
+ @Test
+ fun solve3a() {
+ assertEquals(157, solve3a(rucksacks))
+ }
+
+ @Test
+ fun solve3b() {
+ assertEquals(70, solve3b(rucksacks))
+ }
+}