We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
https://leetcode.com/problems/median-of-two-sorted-arrays/
两个有序数组,合并两个数组,求中位数。
难点是题目要求复杂度是O(m+n)。
先算出两个数组的总长度,循环从排序过的两个数组中取比较小的那个,统计长度,当长度等于总长度的一半时,根据奇数和偶数两种情况得到结果。