removed dead code.
This commit is contained in:
parent
3c4b32fc78
commit
837e5827f4
@ -56,16 +56,6 @@ Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11
|
|||||||
}.sumOf { it!! }
|
}.sumOf { it!! }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun rec(winTable: List<Int>, pos: Int): Int {
|
|
||||||
var sum = winTable[pos]
|
|
||||||
if (sum > 0) {
|
|
||||||
for (j in pos + 1..(pos + sum).coerceAtMost(winTable.lastIndex)) {
|
|
||||||
sum += rec(winTable, pos)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sum
|
|
||||||
}
|
|
||||||
|
|
||||||
fun part2(input: List<String>): Int {
|
fun part2(input: List<String>): Int {
|
||||||
val winTable = input.map {
|
val winTable = input.map {
|
||||||
"Card +(\\d+): (.*)".toRegex().matchEntire(it)?.destructured
|
"Card +(\\d+): (.*)".toRegex().matchEntire(it)?.destructured
|
||||||
|
Loading…
Reference in New Issue
Block a user