Use fold for folds
This commit is contained in:
parent
e014b32ab4
commit
76e670770e
@ -23,12 +23,7 @@ class Day13 : BaseDay() {
|
||||
|
||||
override fun part2(): String {
|
||||
val (nums, folds) = input()
|
||||
var all = nums.toSet()
|
||||
|
||||
folds.forEach { (axis, value) ->
|
||||
all = all.fold(axis, value.toInt())
|
||||
}
|
||||
|
||||
val all = folds.fold(nums.toSet()) { all, (axis, value) -> all.fold(axis, value.toInt()) }
|
||||
val res = StringBuilder()
|
||||
for (y in 0..all.maxOf { it.y }) {
|
||||
for (x in 0..all.maxOf { it.x }) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user