BQN, 2323 10 bytes
Massive savings by porting miles's J solution
@+·×⊸/∘⥊∘⍉∘>(⌈´≠¨)↑¨-⟜@↕∘≠¨⍋⊸⊏○∾⊢
Anonymous tacit function that takes a list of strings and returns a string. Try it at BQN online!Try it at BQN online!
Explanation
@+·×⊸/∘⥊∘⍉∘>(⌈´≠¨)↑¨-⟜@
-⟜@ Subtract null byte, converting strings to lists of ints↕∘≠¨⍋⊸⊏○∾⊢
¨ ≠¨ For each string Lengthin ofthe eachargument list of codepoints:
≠ ⌈´ Maximum ofTake theits lengthslength
↕∘ ( and )↑make a range from 0 to that Takenumber (^ that manyexclusive) elements, right-padding with 0s
¨ fromWith eachthat list of codepoints
lists of indices as ∘>the left argument
⊢ Mergeand the original list of lists into a 2D array, and
of strings ∘⍉as the right argument:
○∾ TransposeFlatten it,both andlists
∘⥊ ⊸⊏ Reshape itIndex into athe flatflattened list,string andusing
·×⊸/ ⍋ Keep only the numbersgrade-up thatof arethe greaterflattened thanlist zero,of andindices
@+
Grade up, for those unfamiliar with APL-related languages, is an operation that takes a list and returns a permutation of its indices, such that if the items in the list were reordered according to the order of the indices, the list would become sorted ascending. For example:
Indices: 0 1 2 3 4 5
List: 3 1 4 1 5 9
Grade up: 1 3 0 2 4 5
Sorted: Add null byte,1 converting1 them3 back4 to5 characters9
The conversion from chars to ints and backThis operation is necessary, because Take pads with spaces rather than null bytes when given auseful for sorting one list according to the values of charsanother list, as seen in the above solution.