Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0004-median-of-two-sorted-arrays #129

Open
jesee030 opened this issue Jun 22, 2021 · 0 comments
Open

0004-median-of-two-sorted-arrays #129

jesee030 opened this issue Jun 22, 2021 · 0 comments

Comments

@jesee030
Copy link

"如图,我们要找到一组A,B,满足上面3条规则。 对于规则1,我们在数组1中找任意A,然后根据规则1就能推算出对应的B的位置。 对于规则2,由于数组1和2都是有序数组,即X1<A<Y1;X2<B<Y2。我们实际上只需要判断A是否小于Y2,以及B是否小于Y2。 对于规则3,由于数组1和2都是有序数组,因此中位数为A,B中较大的那一项。

那么具体该如何操作呢? 由于数组1和2都是有序数组,且题目要求O(log(m+n))复杂度,我们明显应考虑二分法。"
勘误:我们实际上只需要判断A是否小于Y2,以及B是否小于Y1。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant