
Backtracking
weixin_39145266
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
980 Unique Paths III
1 题目On a 2-dimensionalgrid, there are 4 types of squares:1represents the starting square. There is exactly one starting square. 2represents the ending square. There is exactly one ending squ...原创 2019-11-24 14:54:06 · 99 阅读 · 0 评论 -
306 Additive Number
1 题目dditive number is a string whose digits can form additive sequence.A valid additive sequence should containat leastthree numbers. Except for the first two numbers, each subsequent number in ...原创 2019-06-29 20:05:58 · 100 阅读 · 0 评论 -
357 Count Numbers with Unique Digits
1 题目Given anon-negativeinteger n, count all numbers with unique digits, x, where 0 ≤ x < 10n.Example:Input: 2Output: 91 Explanation: The answer should be the total numbers in the range o...原创 2019-07-07 21:07:04 · 88 阅读 · 0 评论 -
131 Palindrome Partitioning
1 题目Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.Example:Input: "aab"Output:[ ["aa","b"], ["...原创 2019-04-16 15:37:06 · 76 阅读 · 0 评论 -
47 Permutations II
1 题目Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]2 尝试解class Solu...原创 2019-04-09 17:41:08 · 82 阅读 · 0 评论 -
77 Combinations
1 题目Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.Example:Input: n = 4, k = 2Output:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]2 尝...原创 2019-04-09 16:55:49 · 104 阅读 · 0 评论 -
60 Permutation Sequence
1 题目The set[1,2,3,...,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order, we get the following sequence forn= 3:"123" "132" "213" "231"...原创 2019-04-03 11:27:17 · 95 阅读 · 0 评论 -
90 Subsets II
1 题目Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: [1...原创 2019-04-11 19:33:27 · 86 阅读 · 0 评论 -
89 Gray Code
1 题目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 sequenc...原创 2019-04-11 18:49:27 · 98 阅读 · 0 评论 -
17 Letter Combinations of a Phone Number
1 题目Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) ...原创 2019-03-29 09:17:50 · 138 阅读 · 0 评论 -
216 Combination Sum III
1 题目Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Note:All number...原创 2019-04-10 17:38:39 · 99 阅读 · 0 评论 -
93 Restore IP Addresses
1 题目Given a string containing only digits, restore it by returning all possible valid IP address combinations.Example:Input: "25525511135"Output: ["255.255.11.135", "255.255.111.35"]2 尝试解...原创 2019-04-10 16:48:09 · 90 阅读 · 0 评论 -
78 Subsets
1 题目Given a set ofdistinctintegers,nums, return all possible subsets (the power set).Note:The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3]...原创 2019-03-29 09:17:01 · 115 阅读 · 0 评论 -
79 Word Search
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 horizontally or vertically ...原创 2019-04-10 15:28:30 · 121 阅读 · 0 评论 -
46 Permutations
1 题目Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]2 尝试解class ...原创 2019-04-05 16:18:39 · 111 阅读 · 0 评论 -
22 Generate Parentheses
1 题目Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:[ "((()))", "(()())", "(())()", "(...原创 2019-04-05 13:11:30 · 99 阅读 · 0 评论