上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
摘要: ----思路:利用三个队列,一个存3,一个存5,一个存7.然后,3*3的都放第一个。然后3*5,5*5的放第二个。然后,3*7,5*7,7*7的都放第三个。答案: public static int findKth(int k){ ArrayList res = new Arra... 阅读全文
posted @ 2015-12-31 15:13 创业-李春跃-增长黑客 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 用^来操作:public static int[] exchangeAB(int[] AB){ AB[0] = AB[0] ^ AB[1]; AB[1] = AB[0] ^ AB[1]; AB[0] = AB[0] ^ AB[1]; retur... 阅读全文
posted @ 2015-12-31 10:45 创业-李春跃-增长黑客 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 直接两个点确定一条直线。然后两两组合,再写一个看过多少个点的函数。一直更新max就行。import java.util.Arrays;public class Solution { public static void main(String[] args){ Point[] a... 阅读全文
posted @ 2015-12-30 21:11 创业-李春跃-增长黑客 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 最主要的思路:1,这条直线就是要把两个正方形的中点链接。2,注意的特殊情况:中心点重合。答案:public class Solution { public static void main(String[] args){ Point[] a = {new Point(13... 阅读全文
posted @ 2015-12-30 14:28 创业-李春跃-增长黑客 阅读(212) 评论(0) 推荐(0) 编辑
摘要: leetcode原题:char temp ; Stack stack = new Stack();//error:Stack stack = new Stack(); //思路,因为他要的是顺序要对。所以我先把(,[,{的存入栈,遇到反向的时候看一下最近的一个是不是他的配... 阅读全文
posted @ 2015-12-30 10:57 创业-李春跃-增长黑客 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 1,这个是自己写的。一直LTE。 public static ArrayList getPerms(String str) { if (str == null) { return null; } ArrayList permuta... 阅读全文
posted @ 2015-12-30 10:49 创业-李春跃-增长黑客 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 这题非常复杂。牛客网上对应的题目对结果要求比较苛刻,所以要调整。整体思路是:先放进去一个,然后第二个来的时候插入到已有的,并且把自己也放进去。public static ArrayList> getSubsets(int[] a, int n){ ArrayList> res = n... 阅读全文
posted @ 2015-12-29 18:56 创业-李春跃-增长黑客 阅读(158) 评论(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 创业-李春跃-增长黑客 阅读(192) 评论(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 创业-李春跃-增长黑客 阅读(218) 评论(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 创业-李春跃-增长黑客 阅读(213) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页