摘要: Q:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated number may be chosen fromCunlimited number of times.Note:All numbers (including target) will be positive integers.Elements in a combination (a1,a2, � , 阅读全文
posted @ 2013-08-10 16:24 summer_zhou 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Q:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"A: DFS问题。 void generate_aux(int leftcount,int rightcount, 阅读全文
posted @ 2013-08-10 15:53 summer_zhou 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Q:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number inCmay only be usedoncein the combination.Note:All numbers (including target) will be positive integers.Elements in a combination (a1,a2, � ,ak) mus 阅读全文
posted @ 2013-08-10 13:35 summer_zhou 阅读(146) 评论(0) 推荐(0) 编辑