import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
*
* @author Kangjun W...
分类:
编程语言 时间:
2015-03-17 00:56:42
阅读次数:
176
problem:
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)).
thinking:
(1)求中位数,就是求已...
分类:
其他好文 时间:
2015-03-16 21:26:18
阅读次数:
162
题目:median of two sorted arrays
知识点:二分查找,中位数定义
public class Solution {
/*
* 关于:leetcode 第二题 给定两个排好序的数组,找到它们的中位数,要求:时间复杂度o(log(m+n));
* 变形:找第k个数
* 方法:1.遍历,时间复杂度为o(m+n),从头开始分别遍历两数组的数,按照大小计数...
分类:
其他好文 时间:
2015-03-16 01:01:30
阅读次数:
172
Problem KK Smallest SumsYou're given k arrays, each array has k integers. There are kk ways to pick exactly one element in each array and calculate th...
分类:
其他好文 时间:
2015-03-15 13:45:14
阅读次数:
228
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 ...
分类:
其他好文 时间:
2015-03-15 12:13:53
阅读次数:
112
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 ...
分类:
其他好文 时间:
2015-03-14 21:40:42
阅读次数:
134
UVA10494:If We Were a Child Again 大数除法加取余import java.util.Arrays;import java.util.Scanner;import java.math.*;public class Main{ public static void ...
分类:
编程语言 时间:
2015-03-14 21:27:57
阅读次数:
168
题目:
给定集合,求它的子集集合。
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class Permutation {
public static void main(String[] args) {...
分类:
其他好文 时间:
2015-03-14 15:28:05
阅读次数:
137
被标记为transient的属性在对象被序列化的时候不会被保存int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = Arrays.copyOf(arr1, new_length);//Arrays是数组的工具类//ArrayList的转化为静态数组的toArray方法...
分类:
编程语言 时间:
2015-03-14 12:20:45
阅读次数:
276
/**
* 给两组数,各n个。
* 请调整每组数的排列顺序,使得两组数据相同下标元素对应相乘,然后相加的和最小。
*/
import java.util.*;
import java.io.*;
public class 最小乘积 {
public static void JianArray(Integer[] b1) {
Arrays.sort(b1);
in...
分类:
其他好文 时间:
2015-03-13 14:27:57
阅读次数:
121