Skip to content

Commit 021917d

Browse files
committed
Adding.
1 parent 33dc642 commit 021917d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# p_4_median_of_two_sorted_arrays
2+
3+
🔗 https://leetcode.com/problems/median-of-two-sorted-arrays/description/?source=submission-noac
4+
5+
## Leetcode - 4 - Median of two sorted arrays
6+
7+
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
8+
9+
The overall run time complexity should be O(log (m+n)).
10+
11+
12+
13+
Example 1:
14+
15+
Input: nums1 = [1,3], nums2 = [2]
16+
Output: 2.00000
17+
Explanation: merged array = [1,2,3] and median is 2.
18+
19+
Example 2:
20+
21+
Input: nums1 = [1,2], nums2 = [3,4]
22+
Output: 2.50000
23+
Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.
24+
25+
26+
Constraints:
27+
28+
nums1.length == m
29+
nums2.length == n
30+
0 <= m <= 1000
31+
0 <= n <= 1000
32+
1 <= m + n <= 2000
33+
-106 <= nums1[i], nums2[i] <= 106

0 commit comments

Comments
 (0)