What is the fastest and most space-efficient way to sort a 2d array with sorted rows:
Input:
[
[2, 3, 5, 6],
[1, 5, 7],
[2, 3, 4, 9],
[2, 3, 4],
]
Output:
[
[1, 5, 7],
[2, 3, 4],
[2, 3, 4, 9],
[2, 3, 5, 6],
]
Note: this is not the same question as Most efficient way to sort a 2d array with sorted rows into 1d sorted array