摘要: 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) 编辑