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 · 67 阅读 · 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 · 67 阅读 · 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: 2 Output: 91 Explanation: The answer should be the total numbers in the range o...原创 2019-07-07 21:07:04 · 58 阅读 · 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 · 48 阅读 · 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 · 53 阅读 · 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 = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] 2 尝...原创 2019-04-09 16:55:49 · 78 阅读 · 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 · 70 阅读 · 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 · 57 阅读 · 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 · 65 阅读 · 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 · 89 阅读 · 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 · 72 阅读 · 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 · 62 阅读 · 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 · 70 阅读 · 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 · 68 阅读 · 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 · 66 阅读 · 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 · 68 阅读 · 0 评论