solution

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 1 Imported by: 0

README

4. Median of Two Sorted Arrays

[困难] 数组 二分查找 分治算法


给定两个大小为 m 和 n 的正序(从小到大)数组 nums1 和 nums2。

请你找出这两个正序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。

你可以假设 nums1 和 nums2 不会同时为空。

 

示例 1:

nums1 = [1, 3]
nums2 = [2]
解释:合并数组 = [1,2,3] ,中位数 2


示例 2:

nums1 = [1, 2]
nums2 = [3, 4]
解释:合并数组 = [1,2,3,4] ,中位数 (2 + 3) / 2 = 2.5


Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL