
backTracking
文章平均质量分 83
ljffdream
这个作者很懒,什么都没留下…
展开
-
【Leetcode】Generate Parent
【题目】Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()((转载 2015-01-12 14:22:55 · 345 阅读 · 0 评论 -
【Leetcode】Grey Code
【题目】The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the se转载 2014-12-24 23:36:22 · 363 阅读 · 0 评论 -
【Leetcode】Permutations
【题目】Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].【分析原创 2015-04-09 04:50:04 · 294 阅读 · 0 评论 -
【Leetcode】Subsets
【题目】Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.转载 2015-07-12 21:17:00 · 361 阅读 · 0 评论 -
【Leetcode】Combination sum 1,2
【题目】【分析】首先,先sort,如果target > 0:【代码】using recursive 这恐怕的 O(n2)...过程:before recursion : [2]before recursion : [2, 2]before recursion : [2, 2, 2]after recursion and remove :转载 2015-08-24 16:47:10 · 355 阅读 · 0 评论 -
[Leetcode]Word Search
[timu]Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontal转载 2015-09-02 07:51:04 · 288 阅读 · 0 评论