0
点赞
收藏
分享

微信扫一扫

【leetcode】4-Median of Two Sorted Arrays

残北 2022-07-13 阅读 47

problem:

​​Median of Two Sorted Arrays​​

什么是median(中值)?

solution中使用的是递归方法,可以自己推导一下下。。。

还没有完全明白,先记录下来。

Seeing someone can't understand why i+j=m−i+n−j (or: m−i+n−j+1)
it's because the lengths of the arrays can be odd or even,
when both are odd or even there is i+j = m−i+n−j
when one array's length is odd and another is even then i+j = m−i+n−j+1

 

参考

1.​​leetcode-4-MedianofTwoSortedArrays​​;

举报

相关推荐

0 条评论