Interleaving n number of lists...
Anonymous User
394

What would be the most efficient way of doing the below...

[[1,2,3], [8,5], [], [4,1, 10]] -> [1,8,4,2,5,1,3,10]

This feels like an easy question but I apparently I didn't do this efficiently enough. I was thinking oh this looks like merging k sorted lists but this is not that given the output

To be clear,

The new list respects the order of the original list so new list is [array[0][0], array[1][0], array[3][0], array[0][1], .. ]

no array[2][0] since it's empty / skip

Comments (2)