Skip to content

Commit e3fdbbe

Browse files
committed
Add more data to merge_two_sorted_lists
1 parent a1aa93d commit e3fdbbe

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## There is no note for this problem yet ¯⁠⁠⁠\(⁠ツ⁠)⁠⁠/⁠¯
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Merge two sorted lists
2+
You are given the heads of two sorted linked lists `list1` and `list2`.
3+
4+
5+
Merge the two lists in a one **sorted** list. The list should be made by splicing together the nodes of the first two lists.
6+
7+
8+
Return *the head of the merged linked list*.
9+
10+
11+
 
12+
13+
14+
**Example 1:**
15+
16+
17+
![](./images/merge_ex1.jpg)
18+
19+
```
20+
**Input:** list1 = [1,2,4], list2 = [1,3,4]
21+
**Output:** [1,1,2,3,4,4]
22+
23+
```
24+
25+
**Example 2:**
26+
27+
28+
29+
```
30+
**Input:** list1 = [], list2 = []
31+
**Output:** []
32+
33+
```
34+
35+
**Example 3:**
36+
37+
38+
39+
```
40+
**Input:** list1 = [], list2 = [0]
41+
**Output:** [0]
42+
43+
```
44+
45+
 
46+
47+
48+
**Constraints:**
49+
50+
51+
* The number of nodes in both lists is in the range `[0, 50]`.
52+
* `-100 <= Node.val <= 100`
53+
* Both `list1` and `list2` are sorted in **non-decreasing** order.
54+
55+
56+
57+
- [Problem URL](https://leetcode.com/problems/merge-two-sorted-lists)
25.8 KB
Loading

0 commit comments

Comments
 (0)