Skip to content

Commit 9c2a0b3

Browse files
Create README - LeetHub
1 parent 0ceab05 commit 9c2a0b3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<h2><a href="https://leetcode.com/problems/median-of-two-sorted-arrays/">4. Median of Two Sorted Arrays</a></h2><h3>Hard</h3><hr><div><p>Given two sorted arrays <code>nums1</code> and <code>nums2</code> of size <code>m</code> and <code>n</code> respectively, return <strong>the median</strong> of the two sorted arrays.</p>
2+
3+
<p>The overall run time complexity should be <code>O(log (m+n))</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> nums1 = [1,3], nums2 = [2]
9+
<strong>Output:</strong> 2.00000
10+
<strong>Explanation:</strong> merged array = [1,2,3] and median is 2.
11+
</pre>
12+
13+
<p><strong>Example 2:</strong></p>
14+
15+
<pre><strong>Input:</strong> nums1 = [1,2], nums2 = [3,4]
16+
<strong>Output:</strong> 2.50000
17+
<strong>Explanation:</strong> merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.
18+
</pre>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>nums1.length == m</code></li>
25+
<li><code>nums2.length == n</code></li>
26+
<li><code>0 &lt;= m &lt;= 1000</code></li>
27+
<li><code>0 &lt;= n &lt;= 1000</code></li>
28+
<li><code>1 &lt;= m + n &lt;= 2000</code></li>
29+
<li><code>-10<sup>6</sup> &lt;= nums1[i], nums2[i] &lt;= 10<sup>6</sup></code></li>
30+
</ul>
31+
</div>

0 commit comments

Comments
 (0)