随笔分类 -  Combination

摘要:class Solution { public List> combinationSum2(int[] candidates, int target) { List> ret=new ArrayList>(); Arrays.sort(candidates); boolean[] used=new boolean[candidates.le... 阅读全文
posted @ 2017-09-24 04:22 Weiyu Wang 阅读(95) 评论(0) 推荐(0)
摘要:public class Solution { public List> combinationSum(int[] candidates, int target) { List> ret=new ArrayList>(); Arrays.sort(candidates); generateCombination(new ArrayList(... 阅读全文
posted @ 2017-09-24 02:39 Weiyu Wang 阅读(125) 评论(0) 推荐(0)
摘要:POJ 2965, The Pilots Brothers' refrigeratorPOJ 1753, Flip Game这两道题类似,可转化图论的最短路径问题:顶点(Vertex)数:65536边(Edge)数:65536 * 16 / 2边的权值(Weight):1对于给定两个点, 求最短路径:由于边的权值均为1, 所以适宜采用BFS + Mark Table, 时间复杂度为O(N), N为... 阅读全文
posted @ 2009-09-27 10:24 Weiyu Wang 阅读(592) 评论(0) 推荐(0)
摘要:POJ 2965, The Pilots Brothers' refrigeratorPOJ 1753, Flip Game这两道题类似,可转化图论的最短路径问题:顶点(Vertex)数:65536边(Edge)数:65536 * 16 / 2边的权值(Weight):1对于给定两个点, 求最短路径:由于边的权值均为1, 所以适宜采用BFS + Mark Table, 时间复杂度为O(N), N为... 阅读全文
posted @ 2009-09-26 13:11 Weiyu Wang 阅读(644) 评论(0) 推荐(1)