上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 34 下一页
摘要: 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * ... 阅读全文
posted @ 2014-07-15 23:05 hansongjiang8 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1.超时的,效率太低 1 public class Solution { 2 public int jump(int[] A) { 3 int len=A.length; 4 int d[]=new int[len]; 5 d[0]=0; 6 ... 阅读全文
posted @ 2014-07-13 22:13 hansongjiang8 阅读(322) 评论(0) 推荐(0) 编辑
摘要: 1。第一次觉得很简单,但是超时了 1 public class Solution { 2 public boolean canJump(int[] A) { 3 4 int len=A.length; 5 boolean b[]=new bo... 阅读全文
posted @ 2014-07-13 20:46 hansongjiang8 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 public int firstMissingPositive(int[] A) { 3 HashSet hash=new HashSet(); 4 int count=0; 5 int... 阅读全文
posted @ 2014-07-13 19:30 hansongjiang8 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 参考https://oj.leetcode.com/problems/distinct-subsequences动态规划方程dp[i][j]=dp[i-1][j-1]+dp[i-1][j] (s(i)==t(i))dp[i][j]=dp[i-1][j];边界条件: iif(j==0) d[i][j]... 阅读全文
posted @ 2014-07-13 18:00 hansongjiang8 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 public String get(String a,String b) 3 { 4 5 if(a==""||b=="") return ""; 6 int len1=a.le... 阅读全文
posted @ 2014-07-13 00:46 hansongjiang8 阅读(142) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int longestConsecutive(int[] num) { HashSet hash=new HashSet(); int max=1; for(int n:num) ... 阅读全文
posted @ 2014-07-13 00:21 hansongjiang8 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1.从外围搜索O,深度搜索出现了Line 35: java.lang.StackOverflowErrorLast executed input:["OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO 1 public class Solution { 2... 阅读全文
posted @ 2014-07-12 23:09 hansongjiang8 阅读(660) 评论(0) 推荐(0) 编辑
摘要: stl 中的下一个排列在写一遍忘了写个1个多小时,使用递归写的,错误就在我使用一个list保存当前剩下的数,然后利用k/(n-1)!的阶乘就是删除的数字,但进过观察,比如 list={1,2,3}分成3组:1 {2,3}2 {1,3}3 {1,2}确定位于哪个组,然后确定位于哪个组的第几个nyoj ... 阅读全文
posted @ 2014-07-12 22:10 hansongjiang8 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 1.枚举法(超时) 1 public class Solution { 2 public int largestRectangleArea(int[] height) { 3 int max=-1; 4 for(int i=0;i=0&&height[k] s... 阅读全文
posted @ 2014-07-12 16:01 hansongjiang8 阅读(427) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 34 下一页