This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package day6 | |
import java.io.File | |
import java.lang.IllegalArgumentException | |
fun main() { | |
val list = day1.readFileLineByLine("src/main/kotlin/day6/input.txt"); | |
solvePart1(list[0]); | |
solvePart2(list[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package day5 | |
import java.io.File | |
fun main() { | |
val list = day1.readFileLineByLine("src/main/kotlin/day5/input.txt"); | |
val initialCrates = | |
mutableListOf("BLDTWCFM", "NBL", "JCHTLV", "SPJW", "ZSCFTLR", "WDGBHNZ", "FMSPVGCN", "WQRJFVCZ", "RPMLH") | |
val initialCratesCopy1 = initialCrates.toMutableList() | |
val initialCratesCopy2 = initialCrates.toMutableList() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File | |
fun main() { | |
val list = readFileLineByLine("src/main/kotlin/day4/input.txt"); | |
solvePart1(list) | |
solvePart2(list) | |
} | |
fun solvePart1(list: List<String>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package day3 | |
import java.io.File | |
fun main() { | |
val list = readFileLineByLine("src/main/kotlin/day3/input.txt"); | |
solvePart1(list) | |
solvePart2(list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package day2 | |
import java.io.File | |
fun main() { | |
val list = day1.readFileLineByLine("src/main/kotlin/day2/input.txt"); | |
var totalScore = 0; | |
list.forEach{ | |
val tokens = it.split(" "); | |
totalScore += getWinScore(tokens[0],tokens[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val list = readFileLineByLine("src/main/kotlin/day1/input.txt"); | |
val listOfLists = mutableListOf<MutableList<String>>() | |
var lastIndex = 0; | |
for (i in 0 until list.size) { | |
if (list[i] == "") { | |
listOfLists.add(list.subList(lastIndex, i)) | |
lastIndex = i + 1; | |
} | |
} |