![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
深度搜索
forest小拳拳
这个作者很懒,什么都没留下…
展开
-
Leetcode-Combination Sum(深搜)
Given a set of candidate numbers (C)(without duplicates) and a target number (T), find all unique combinations inC where the candidate numbers sums to T.The same repeated number may be chosen原创 2017-07-19 17:36:02 · 137 阅读 · 0 评论 -
Leetcode-Same Tree
Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example 1:In...原创 2018-03-18 22:48:32 · 110 阅读 · 0 评论 -
Leetcode-Word Search(dfs)
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原创 2017-10-26 16:52:37 · 178 阅读 · 0 评论 -
Leetcode-Subsets(dfs)
Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example,If nums = [1,2,3], a solution is:[原创 2017-10-24 23:47:52 · 182 阅读 · 0 评论 -
Leetcode-Combination(dfs)
Given 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:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]原创 2017-10-24 17:02:17 · 175 阅读 · 0 评论 -
Leetcode-N-Queens
The n-queens puzzle is the problem of placing n queens on ann×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Ea原创 2017-09-11 14:36:54 · 154 阅读 · 0 评论 -
Leetcode-N-Queens II
Discuss Pick OneFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions. class Solution原创 2017-09-13 16:52:17 · 147 阅读 · 0 评论 -
Leetcode-Permutation(next_permutation或者深搜)
Given a collection of distinct 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], [3,2,1]原创 2017-08-06 18:04:15 · 177 阅读 · 0 评论 -
Leetcode-Combination Sum ll(深搜)
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inC where the candidate numbers sums to T.Each number in C may only be used once in the combinatio原创 2017-07-28 17:43:07 · 160 阅读 · 0 评论 -
Leetcode-Permutation ll(深搜)
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique permutations:[ [1,1,2], [1,2,1], [2,1,1原创 2017-08-08 13:56:55 · 186 阅读 · 0 评论 -
129. Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota...原创 2019-02-08 02:02:41 · 75 阅读 · 0 评论