Skip to content

Commit d71afce

Browse files
committed
minor improvement to day 18
1 parent cc8b497 commit d71afce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/kotlin/Day18_OperationOrder.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Day18 : Day(18, title = "Operation Order") {
2222
private fun String.evaluatePart2(): Long {
2323
trim().toLongOrNull()?.let { return it }
2424

25-
val tokens = tokenize()
25+
val tokens = tokenize().toMutableList()
2626
val operationsInOrder = listOf<Pair<String, Long.(Long) -> Long>>("+" to Long::plus, "*" to Long::times)
2727
operationsInOrder.forEach { (operator, operation) ->
2828
while (tokens.contains(operator)) {
@@ -37,7 +37,7 @@ class Day18 : Day(18, title = "Operation Order") {
3737
return tokens.single().toLong()
3838
}
3939

40-
private fun String.tokenize(): MutableList<String> {
40+
private fun String.tokenize(): List<String> {
4141
var s = this.trim()
4242
val tokens = mutableListOf<String>()
4343
do {

0 commit comments

Comments
 (0)