码迷,mamicode.com
首页 > 其他好文 > 详细

# LeetCode 4 ## problem4

时间:2018-04-16 00:44:14      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:exit   cond   apply   problem   ble   leetcode   --   code   com   

# LeetCode 4
## problem4
---
There is a very obscure condition here:

* i + j == m - i + n - j
* i means the index of the first array.
* j means the index of the second array.
* m means the sum of the length of the two arrays.

And the second condition is that :

* If the a[i] >= b [j-1] && b[j] >= a[i-1],the i and j are the final result that we want.
* The a[] and b[] are the two arrays.

Then we can apply these two conditions into our binary search.

The time complexity of the solution is O(min(m,n)).

 

# LeetCode 4 ## problem4

标签:exit   cond   apply   problem   ble   leetcode   --   code   com   

原文地址:https://www.cnblogs.com/xintt/p/8850291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!