摘要:
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... 阅读全文
摘要:
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... 阅读全文