Median of Two Sorted Arrays Total Accepted: 4990 Total Submissions: 30805My Submissions
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. Th...
分类:
其他好文 时间:
2015-04-03 13:34:56
阅读次数:
151
题目地址:https://leetcode.com/problems/median-of-two-sorted-arrays/
这道题就是求两个有序序列的中位数。这也是2015年4月阿里实习生招人附加题第一题
我用的是归并算法,时间复杂度和空间复杂度都为O(M+N)
class Solution {
public:
double findMedianSortedArrays(int ...
分类:
其他好文 时间:
2015-04-03 11:18:54
阅读次数:
134
1.JSONObject介绍JSONObject-lib包是一个beans,collections,maps,java arrays和xml和JSON互相转换的包。2.下载jar包http://files.cnblogs.com/java-pan/lib.rar提供了除JSONObject的jar之...
分类:
Web程序 时间:
2015-04-03 10:48:02
阅读次数:
271
排序算法有很多种,主要分为插入排序(直接插入排序、二分法插入排序)、交换排序(冒泡排序、快速排序)、选择排序(简单选择排序、堆排序)等,这里不说原理了,只贴代码。原理可以看严蔚敏的数据结构或者网上有人讲的原理很详细。给大家推荐一个链接点击打开链接
1.直接插入排序
package sortpackage;
import java.util.Arrays;
public class inse...
分类:
编程语言 时间:
2015-04-02 16:25:31
阅读次数:
157
1、String类型字符串转化为数组: char[] array = str.toCharArray();2、数组排序: Arrays.sort(array);3、大小写转换: String str1 = mScanner.next().toLowerCase(); String str2 ...
分类:
其他好文 时间:
2015-04-01 21:29:21
阅读次数:
104
8.DataMappingConfigurer/**CreatedonOct8,2013**Copyright2006ATPCOConfidentialandProprietary.AllRightsReserved.*/packagenet.atpco.dds.offline.filing.common.datamapper.binder;importjava.io.IOException;importjava.util.ArrayList;importjava.util.Arrays;importjava..
分类:
数据库 时间:
2015-04-01 20:14:40
阅读次数:
240
类型互转
1.各种类型转String
2.String转Bytes
3.数组转List
4.进制转换
5.
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util....
分类:
编程语言 时间:
2015-04-01 09:33:46
阅读次数:
156
题目:
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)).
思路:这道题比较直接的想法就是用Merge
Sort...
分类:
其他好文 时间:
2015-04-01 09:33:08
阅读次数:
143
题目链接:valid-sudoku
import java.util.Arrays;
/**
*
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells ...
分类:
其他好文 时间:
2015-03-31 12:52:27
阅读次数:
208
题目链接:n-queens
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
*
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no t...
分类:
其他好文 时间:
2015-03-31 09:06:07
阅读次数:
156