However the inner arrays are harder to get rid of... In fact even OP’s oneliner defines the inner arrays. I would hope there were some engine optimizations though which could minimize their footprint.
Please see my other comment in this thread for the `reduce`-based solution that requires no extra data structures. They're not that hard to get rid of!
runarberg|4 years ago
keville|4 years ago