上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 36 下一页
摘要: 1 public class Solution { 2 public int getMoneyAmount(int n) { 3 int[][] dp = new int[n + 2][n + 2]; 4 for (int len = 1; len < n; len++) { 5 for (int left = 1; le... 阅读全文
posted @ 2016-07-27 04:54 keepshuatishuati 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 public int combinationSum4(int[] nums, int target) { 3 Arrays.sort(nums); 4 int[] result = new int[target + 1]; 5 for (int i = 1; i i) { ... 阅读全文
posted @ 2016-07-27 04:33 keepshuatishuati 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 /* The guess API is defined in the parent class GuessGame. 2 @param num, your guess 3 @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 4 int guess(int ... 阅读全文
posted @ 2016-07-27 02:07 keepshuatishuati 阅读(156) 评论(0) 推荐(0) 编辑
摘要: KMP 阅读全文
posted @ 2016-07-08 12:49 keepshuatishuati 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Dijkstra Algorithm 阅读全文
posted @ 2016-07-08 05:55 keepshuatishuati 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution { 2 public boolean canPermutePalindrome(String s) { 3 Map letters = new HashMap(); 4 for (char c : s.toCharArray()) { 5 letters.put(c, let... 阅读全文
posted @ 2016-07-07 15:44 keepshuatishuati 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 */ 10 1... 阅读全文
posted @ 2016-07-07 15:37 keepshuatishuati 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1. No circle : parent index not equal 2. Only one root. 阅读全文
posted @ 2016-07-07 15:36 keepshuatishuati 阅读(158) 评论(0) 推荐(0) 编辑
摘要: O(n) space, O(n) time. it costs more for java sort primitive type in descending order. So use reversed index to get the idea. 阅读全文
posted @ 2016-07-07 13:49 keepshuatishuati 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Say we have two count diff color and same color before. When we update it, for this layer: 1. If previous two layers are same color. We only can choos 阅读全文
posted @ 2016-07-07 13:33 keepshuatishuati 阅读(139) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 36 下一页