LeetCode 23. Merge K Sorted Lists
Description
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
将k
个有序链表合并为一个链表
Solution
前面刚做了两条链表的合并Merge Two Sorted Lists。
既然两个的合并都做了,k个还会难吗?
显然,将k个链表两两合一即可。
|
|
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
将k
个有序链表合并为一个链表
前面刚做了两条链表的合并Merge Two Sorted Lists。
既然两个的合并都做了,k个还会难吗?
显然,将k个链表两两合一即可。
|
|