Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 74f1537

Browse files
authored
0004_Solved
0004_Solved
1 parent bcacf82 commit 74f1537

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎0004-median-of-two-sorted-arrays/Article/0004-median-of-two-sorted-arrays.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ nums2 = [3, 4]
3131

3232
首先,我们可以只考虑数字总个数为奇数的情况。让我们看下下图:
3333

34-
![](../Animation/image1.png)
34+
![](../Animation/image1.PNG)
3535

3636
蓝框是中位数左边的数(包括中位数),而橘框则为中位数右边的数。
3737

3838
3个显然的规则:
3939
1.两个数组的蓝框总个数=(数字总个数+1)/2;
4040
2.所有蓝框内的数都小于橘框内的数
4141
3.中位数为蓝框中最大的那一位(即数组1蓝框最后一位,或数组2蓝框最后一位)
42-
![](../Animation/image2.png)
42+
![](../Animation/image2.PNG)
4343
如图,我们要找到一组A,B,满足上面3条规则。
4444
对于规则1,我们在数组1中找任意A,然后根据规则1就能推算出对应的B的位置。
4545
对于规则2,由于数组1和2都是有序数组,即X1<A<Y1;X2<B<Y2。我们实际上只需要判断A是否小于Y2,以及B是否小于Y2。

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /