From f248ccde1700f482e14c0b53778a08d176dfe498 Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Fri, 6 Dec 2024 21:51:21 -0700 Subject: [PATCH] Day 7 --- day7/part1.kts | 38 ++++++++++++++++++++++++++++++++++++++ day7/part2.kts | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100755 day7/part1.kts create mode 100755 day7/part2.kts diff --git a/day7/part1.kts b/day7/part1.kts new file mode 100755 index 0000000..4d53df4 --- /dev/null +++ b/day7/part1.kts @@ -0,0 +1,38 @@ +#!/usr/bin/env kotlin + +import java.io.File +import java.time.Instant +import java.util.* + +val start = Instant.now() + +val tests = File("./input.txt").readLines().map { + Pair(it.split(": ")[0], it.split(": ")[1]) +}.map { + Pair(it.first.toLong(), it.second.split(" ").map { n -> n.toLong() }) +} + +var finalResult = 0L + +tests.forEach { (test, values) -> + var results = LinkedList() + results.add(values[0]) + + for (i in 1.. n.toLong() }) +} + +var finalResult = 0L + +tests.forEach { (test, values) -> + var results = LinkedList() + results.add(values[0]) + + for (i in 1..