You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme/0088-merge-sorted-array.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
-
<h2> 16022 2155
2
-
88. Merge Sorted Array</h2><hr><div><p>You are given two integer arrays <code>nums1</code> and <code>nums2</code>, sorted in <strong>non-decreasing order</strong>, and two integers <code>m</code> and <code>n</code>, representing the number of elements in <code>nums1</code> and <code>nums2</code> respectively.</p>
1
+
<h2><ahref="https://leetcode.com/problems/merge-sorted-array">88. Merge Sorted Array</a></h2><h3>Easy</h3><hr><p>You are given two integer arrays <code>nums1</code> and <code>nums2</code>, sorted in <strong>non-decreasing order</strong>, and two integers <code>m</code> and <code>n</code>, representing the number of elements in <code>nums1</code> and <code>nums2</code> respectively.</p>
3
2
4
3
<p><strong>Merge</strong> <code>nums1</code> and <code>nums2</code> into a single array sorted in <strong>non-decreasing order</strong>.</p>
5
4
@@ -8,23 +7,26 @@
8
7
<p> </p>
9
8
<p><strongclass="example">Example 1:</strong></p>
10
9
11
-
<pre><strong>Input:</strong> nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3
10
+
<pre>
11
+
<strong>Input:</strong> nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3
12
12
<strong>Output:</strong> [1,2,2,3,5,6]
13
13
<strong>Explanation:</strong> The arrays we are merging are [1,2,3] and [2,5,6].
14
14
The result of the merge is [<u>1</u>,<u>2</u>,2,<u>3</u>,5,6] with the underlined elements coming from nums1.
15
15
</pre>
16
16
17
17
<p><strongclass="example">Example 2:</strong></p>
18
18
19
-
<pre><strong>Input:</strong> nums1 = [1], m = 1, nums2 = [], n = 0
19
+
<pre>
20
+
<strong>Input:</strong> nums1 = [1], m = 1, nums2 = [], n = 0
20
21
<strong>Output:</strong> [1]
21
22
<strong>Explanation:</strong> The arrays we are merging are [1] and [].
22
23
The result of the merge is [1].
23
24
</pre>
24
25
25
26
<p><strongclass="example">Example 3:</strong></p>
26
27
27
-
<pre><strong>Input:</strong> nums1 = [0], m = 0, nums2 = [1], n = 1
28
+
<pre>
29
+
<strong>Input:</strong> nums1 = [0], m = 0, nums2 = [1], n = 1
28
30
<strong>Output:</strong> [1]
29
31
<strong>Explanation:</strong> The arrays we are merging are [] and [1].
30
32
The result of the merge is [1].
@@ -44,4 +46,3 @@ Note that because m = 0, there are no elements in nums1. The 0 is only there to
44
46
45
47
<p> </p>
46
48
<p><strong>Follow up: </strong>Can you come up with an algorithm that runs in <code>O(m + n)</code> time?</p>
0 commit comments