
Backtracking
Peng_maple
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[LeetCode] 37. Sudoku Solver
Sudoku Solver Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each ro...原创 2019-03-29 14:14:21 · 200 阅读 · 0 评论 -
[LeetCode] 22. Generate Parentheses
Generate Parentheses 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: [ “((()))”, “(()())”, “(())()...原创 2019-03-27 17:16:21 · 148 阅读 · 0 评论 -
[LeetCode] 17. Letter Combinations of a Phone Number
Letter Combinations of a Phone Number Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just ...原创 2019-03-27 15:44:43 · 276 阅读 · 0 评论 -
[LeetCode] 46. Permutations
Permutations 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] ] 解析 生成全排列。 解法1:DFS 用一个...原创 2019-04-01 16:39:43 · 161 阅读 · 0 评论 -
[LeetCode] 47. Permutations 2
Permutations 2 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] ] 解析 相比于Permutations,...原创 2019-04-02 15:02:52 · 203 阅读 · 0 评论 -
[LeetCode] 51. N-Queens
N-Queens The 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 to the n-queens puzzle...原创 2019-04-02 16:15:46 · 194 阅读 · 0 评论 -
[LeetCode] 93. Restore IP Addresses
Restore IP Addresses 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.3...原创 2019-07-25 20:28:53 · 121 阅读 · 0 评论 -
[LeetCode] 78. Subsets && 90. Subsets II
Subsets Given a set of distinct integers, 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-07-26 20:17:42 · 160 阅读 · 0 评论 -
[leetcode] 131. Palindrome Partitioning
Palindrome Partitioning 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: [ [“a...原创 2019-08-16 16:48:42 · 172 阅读 · 0 评论