Backtracking
文章平均质量分 63
jialuyyy
这个作者很懒,什么都没留下…
展开
-
Gray Code
Gray CodeThe 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, pri原创 2015-05-28 07:36:52 · 163 阅读 · 0 评论 -
Combinations Related
CombinationsGiven two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[[1,2] [1,3] [1,4] [2,3] [2,4] [3,4]]原创 2015-05-28 07:42:45 · 185 阅读 · 0 评论 -
Subsets
SubsetsGiven 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-05-28 10:09:27 · 176 阅读 · 0 评论 -
Subsets2
Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain du原创 2015-05-28 10:13:42 · 179 阅读 · 0 评论 -
Word Search
Word SearchGiven 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 horizonta原创 2015-06-21 22:35:05 · 201 阅读 · 0 评论 -
N-Queens
N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions原创 2015-07-01 02:28:18 · 171 阅读 · 0 评论 -
N-Queens II
N-Queens IIFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Please refer to the N-queens.public原创 2015-07-01 02:53:50 · 152 阅读 · 0 评论 -
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].public clas原创 2015-05-28 10:20:34 · 160 阅读 · 0 评论