Kroppeb
12/08/2019, 5:16 AMKroppeb
12/08/2019, 5:19 AMreduce
exists, and instead using a fold. Not using fold(data.first, data.drop(1)
, no that wouldn't have been good enough.
I went with
List<Int>?>(null){ acc, n ->
if(acc == null)
return@fold n
acc.zip(n){a,b->
if(a == 2)
b
else
a
}
}!!
I first forgot the return@fold
which is why the the !!
. I should have listen to the compiler instead of getting that NPE getting shoved in my faceKroppeb
12/08/2019, 5:20 AMKroppeb
12/08/2019, 5:20 AMKroppeb
12/08/2019, 5:38 AMkarelpeeters
12/08/2019, 9:11 AMfind
?Kroppeb
12/08/2019, 9:14 AMkarelpeeters
12/08/2019, 9:15 AMfind
over the entire grid at once, makes sense.Kroppeb
12/08/2019, 9:15 AM