赵乐ACM

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年6月24日

摘要: There are two sorted arrays A and B 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)).解题思路:该题可以解决所有求有序数组A和B有序合并之后第k小的数!该题的重要结论:如果A[k/2-1] n) return findKth(B, n, A, m, k); if (m == 0) return B[k... 阅读全文
posted @ 2013-06-24 21:02 赵乐ACM 阅读(9888) 评论(0) 推荐(0) 编辑

摘要: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are 阅读全文
posted @ 2013-06-24 17:52 赵乐ACM 阅读(11301) 评论(6) 推荐(1) 编辑