合并 2 个有序链表(Merge Two Sorted Lists)

This commit is contained in:
YuCheng Hu 2023-11-09 08:52:45 -05:00
parent af5f495fa9
commit 05adc63b3a
No known key found for this signature in database
GPG Key ID: 942395299055675C
2 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,4 @@
- [合并 2 个有序链表]()
- [带环链表](/algorithm/linked-list-cycle.md)
- [电话号码的字母组合](/algorithm/letter-combinations-of-a-phone-number.md)
- [格雷编码](/algorithm/gray-code.md)

View File

@ -0,0 +1,22 @@
# 合并 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
## 点评
本题主要涉及到链表的遍历和比较,基本上不会太难。
可能在写法上有点绕。