docs-isharkfly-com/docs/algorithm/merge-two-sorted-lists.md

22 lines
632 B
Markdown
Raw Permalink Normal View History

# 合并 2 个有序链表Merge Two Sorted Lists
> 🔔 参与讨论https://www.isharkfly.com/t/2-merge-two-sorted-lists/15123
## 描述
将两个排序链表合并为一个新的排序链表。
## 样例
给出 `1->3->8->11->15->null``2->null` 返回 `1->2->3->8->11->15->null`
## 代码
GitHub 的源代码,请访问下面的链接:
https://github.com/honeymoose/codebank-algorithm/blob/main/src/test/java/com/ossez/codebank/algorithm/tests/lintcode/LintCode0165MergeTwoListsTest.java
## 点评
本题主要涉及到链表的遍历和比较,基本上不会太难。
可能在写法上有点绕。