上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: leetcode原题:char temp ; Stack stack = new Stack();//error:Stack stack = new Stack(); //思路,因为他要的是顺序要对。所以我先把(,[,{的存入栈,遇到反向的时候看一下最近的一个是不是他的配... 阅读全文
posted @ 2015-12-30 10:57 仔细思考一切 阅读(251) 评论(0) 推荐(0)
摘要: 1,这个是自己写的。一直LTE。 public static ArrayList getPerms(String str) { if (str == null) { return null; } ArrayList permuta... 阅读全文
posted @ 2015-12-30 10:49 仔细思考一切 阅读(254) 评论(0) 推荐(0)
摘要: 这题非常复杂。牛客网上对应的题目对结果要求比较苛刻,所以要调整。整体思路是:先放进去一个,然后第二个来的时候插入到已有的,并且把自己也放进去。public static ArrayList> getSubsets(int[] a, int n){ ArrayList> res = n... 阅读全文
posted @ 2015-12-29 18:56 仔细思考一切 阅读(161) 评论(0) 推荐(0)
摘要: 魔术索引1:此外下一次应该看看课本上的方法。 public boolean findMagicIndex(int[] A, int n){ for(int i = 0; i < A.length; i++){ if(i == A[i]) { ... 阅读全文
posted @ 2015-12-29 11:42 仔细思考一切 阅读(198) 评论(0) 推荐(0)
摘要: 这道题只需要把障碍点都设为0就可以了。public static int countWays(int[][] map,int x, int y){ if( x < 0 || y < 0) return -1; int[][] dp = new int[x][y]; ... 阅读全文
posted @ 2015-12-29 11:33 仔细思考一切 阅读(224) 评论(0) 推荐(0)
摘要: 这题就是dp的一般题目 public static int countWays(int x, int y){ if( x < 0 || y < 0) return -1; int[][] dp = new int[x][y]; ... 阅读全文
posted @ 2015-12-29 11:26 仔细思考一切 阅读(216) 评论(0) 推荐(0)
摘要: 注意:错误主要在溢出问题上。所以不设置int,而是long。 public static int countWays(int n){ if(n == 1) return 1; if(n == 2) return 2; if(n == 3) re... 阅读全文
posted @ 2015-12-29 11:18 仔细思考一切 阅读(176) 评论(0) 推荐(0)
摘要: public static int[] getCloseNumber(int x){ int[] res = new int[2]; int i = 1; int num = oneNumber(x); while(res[0] == ... 阅读全文
posted @ 2015-12-29 11:01 仔细思考一切 阅读(193) 评论(0) 推荐(0)
摘要: 注意:仔细注意位置。 public static int[] renderPixel(int[] screen, int x, int y){ int[] ans = new int[screen.length ]; int[] tmp = new int[scre... 阅读全文
posted @ 2015-12-29 09:52 仔细思考一切 阅读(196) 评论(0) 推荐(0)
摘要: 注意:1,除法那里b+=b是错的。b一直在改变。 2,仔细一点。import java.util.*;public class AddSubstitution { public int calc(int a, int b, int type) { // write code... 阅读全文
posted @ 2015-12-28 15:45 仔细思考一切 阅读(246) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页