0
Flatten from the inside out
Say we have a ragged list
[
[1, 2],
[3,
[4, 5]
],
]
And we want to flatten it by a layer, decreasing its depth by 1. We could flatten it from the outside:
[1, 2, 3, [4, 5]]
Or, we could flatten it from the inside.
To do this, take all subarrays with maxima...