Skip to content

Instantly share code, notes, and snippets.

@seanchen1991
Last active April 23, 2020 20:42
Show Gist options
  • Save seanchen1991/fd0327e7d987f853bcc5a5f84504d30a to your computer and use it in GitHub Desktop.
Save seanchen1991/fd0327e7d987f853bcc5a5f84504d30a to your computer and use it in GitHub Desktop.
Merge M Sorted Lists of Variable Length

Merge M Sorted Lists of Variable Length

Given M lists of variable length where every element in each list is sorted, print them out in sorted order efficiently.

Examples

Input: Four sorted lists of variable length

[32, 33],
[10, 20, 30, 40],
[15, 25, 35],
[27, 29, 37, 48, 93]

Output: 10, 15, 20, 25, 27, 29, 30, 32, 33, 35, 37, 40, 48, 93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment