https://oj.leetcode.com/problems/decode-ways/http://blog.csdn.net/linhuanmars/article/details/24570759publicclassSolution{
publicintnumDecodings(Strings)
{
if(s==null||s.length()==0)
return0;//invalidinput
char[]chars=s.toCharArray();
if(chars[0]==‘0‘)
re..
分类:
其他好文 时间:
2015-01-05 16:50:25
阅读次数:
137
https://oj.leetcode.com/problems/reverse-linked-list-ii/http://blog.csdn.net/linhuanmars/article/details/24613781/**
*Definitionforsingly-linkedlist.
*publicclassListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolu..
分类:
其他好文 时间:
2015-01-05 16:50:17
阅读次数:
125
原题链接:https://oj.leetcode.com/problems/two-sum/
撇开暴力破解,这道题有众所周知的两种做法:
1. 先排序,再一前一尾双指针。这种方法要注意的是,排序时需要保存原来的index,这样的话其实是一个有着value和index的结构体基于value的排序。
2. 直接hash。这道题需要注意的是,如果数组有两个相同元素,但是仍然构成唯一解。比如...
分类:
其他好文 时间:
2015-01-05 14:54:31
阅读次数:
190
https://oj.leetcode.com/problems/merge-sorted-array/http://blog.csdn.net/linhuanmars/article/details/19712333publicclassSolution{
publicvoidmerge(intA[],intm,intB[],intn){
//SolutionA:
//merge_NoExtraSpace(A,m,B,n);
//SolutionB:
merge_ExtraSpace(A,m,B,n);..
分类:
其他好文 时间:
2015-01-05 07:14:31
阅读次数:
141
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
https://oj.leetcode.com/problems/largest-rectangle-in-histogram/http://blog.csdn.net/linhuanmars/article/details/20524507publicclassSolution{
publicintlargestRectangleArea(int[]height)
{
//SolutionA
//returnlargestRectangleArea_Expand(height);
//SolutionB
..
分类:
其他好文 时间:
2015-01-05 07:13:52
阅读次数:
132
https://oj.leetcode.com/problems/gray-code/publicclassSolution{
publicList<Integer>grayCode(intn)
{
//规律:
//n=0:
//0
//
//n=1:
//0
//1
//
//n=2:
//00
//01
//11
//10
//
//n=3
//000
//001
//011
//010
//110
//111
//101
//100
//
//设n-1结果集为s
//正序..
分类:
其他好文 时间:
2015-01-05 07:12:52
阅读次数:
150
QTP10补丁汇总QTP_00591.EXE QTP10 调试器视图问题的补丁 QTP_00591 - Prevent QuickTest Debug Viewer Problems when Process Debug Manager is InstalledQTPWEB_00037.EXE QT...
分类:
其他好文 时间:
2015-01-04 22:40:38
阅读次数:
320
https://oj.leetcode.com/problems/climbing-stairs/http://blog.csdn.net/linhuanmars/article/details/23976963publicclassSolution{
publicintclimbStairs(intn)
{
//Arecursivesolution
//if(n==1||n==2)
//{
//return1;
//}
//returnclimbStairs(n-1)+climbStairs(n-2);
..
分类:
其他好文 时间:
2015-01-04 19:45:15
阅读次数:
147
https://oj.leetcode.com/problems/sqrtx/http://blog.csdn.net/linhuanmars/article/details/20089131publicclassSolution{
publicintsqrt(intx){
//Assumex>=0
if(x==0)
return0;
returns(x,0L,(long)x);
}
privateintcalc(intx,longlow,longhigh)
{
//Whyusinglong.
/..
分类:
其他好文 时间:
2015-01-04 19:44:12
阅读次数:
143