会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
蒋闯
博客园
首页
新随笔
联系
订阅
管理
2017年2月23日
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)).
摘要: 解题思路:合并两个数组,创建一个 Map对象,用以存放排好顺序的键值对,键为序号,值为数组值,中位数的结果分两种情况讨论: 1、m+n为奇数:(m+n)/2为中位数 2、m+n为偶数:(((m+n)/2-1)+(m+n)/2)/2为中位数 public class FindMedianNum { p
阅读全文
posted @ 2017-02-23 14:27 蒋闯
阅读(354)
评论(0)
推荐(0)