加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

【LeetCode】4. Median of Two Sorted Arrays(C++)

发布时间:2020-12-15 04:52:46 所属栏目:百科 来源:网络整理
导读:地址:https://leetcode.com/problems/median-of-two-sorted-arrays/ 题目: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log(m+n

地址:https://leetcode.com/problems/median-of-two-sorted-arrays/

题目:

There are two sorted arrays nums1 and nums2 of size m and n respectively.

Find the median of the two sorted arrays. The overall run time complexity should be O(log(m+n))O(log (m+n))O(log(m+n)).

You may assume nums1 and nums2 cannot be both empty.

Example 1:

nums1 = [1,3]


nums2 = [2]


The median is 2.0

Example 2:

nums1 = [1,2]


nums2 = [3,4]


The median is (2 + 3)/2 = 2.5

理解:

寻找两个有序数组的中位数。


第一次刷hard,并不会

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读