Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro...
分类:
其他好文 时间:
2015-01-08 09:43:18
阅读次数:
169
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)).
分析
这是一道非常经典的题。这题更通用的形式是,给定两个已经排序...
分类:
其他好文 时间:
2015-01-07 23:39:15
阅读次数:
345
对于两个数组的折半查找public class Solution { public double findMedianSortedArrays(int A[], int B[]) { int m = A.length, n = B.length; if (n == ...
分类:
其他好文 时间:
2015-01-07 22:00:34
阅读次数:
183
1.什么是Comparable接口
此接口强行对实现它的每个类的对象进行整体排序。此排序被称为该类的自然排序 ,类的 compareTo 方法被称为它的自然比较方法 。实现此接口的对象列表(和数组)可以通过 Collections.sort (和 Arrays.sort )进行自动排序。实现此接口的对象可以用作有序映射表中的键或有序集合中的元素,无需指定比较器。
强烈推荐(虽然不是必需的...
分类:
其他好文 时间:
2015-01-07 11:03:10
阅读次数:
185
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal...
分类:
其他好文 时间:
2015-01-06 15:28:32
阅读次数:
131
【题目】
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elem...
分类:
其他好文 时间:
2015-01-05 22:01:41
阅读次数:
238
https://oj.leetcode.com/problems/subsets-ii/http://blog.csdn.net/linhuanmars/article/details/24613193publicclassSolution{
publicList<List<Integer>>subsetsWithDup(int[]num){
Arrays.sort(num);
Set<List<Integer>>results=newHashSet<..
分类:
其他好文 时间:
2015-01-05 07:13:53
阅读次数:
190
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)).
public class Solution {
pu...
分类:
其他好文 时间:
2015-01-04 21:25:03
阅读次数:
150
https://oj.leetcode.com/problems/subsets/http://blog.csdn.net/linhuanmars/article/details/24286377publicclassSolution{
publicList<List<Integer>>subsets(int[]S){
Arrays.sort(S);
List<List<Integer>>results=newArrayList<>();
hel..
分类:
其他好文 时间:
2015-01-04 19:35:38
阅读次数:
146
https://oj.leetcode.com/problems/subsets/http://blog.csdn.net/linhuanmars/article/details/24286377publicclassSolution{
publicList<List<Integer>>subsets(int[]S){
Arrays.sort(S);
List<List<Integer>>results=newArrayList<>();
hel..
分类:
其他好文 时间:
2015-01-04 19:34:20
阅读次数:
306