【leetcode】4-Median of Two Sorted Arrays

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

posted on 2018-10-24 09:11  鹅要长大  阅读(123)  评论(0编辑  收藏  举报

导航