摘要: 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)).比较容易想到的做法是O(n),merge两个数组,然后求中值。 1 public class Solution { 2 public double findMedianSortedArrays(int A[], int B[]) { 3 // Sta... 阅读全文
posted @ 2013-06-15 18:07 feiling 阅读(460) 评论(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 nu... 阅读全文
posted @ 2013-06-15 17:50 feiling 阅读(226) 评论(0) 推荐(0) 编辑