dfs

207. Course Schedule

题目:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expr

301. Remove Invalid Parenthesis

问题: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may contain letters other than the parenth

329. Longest Increasing Path in a Matri

题目:Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or m

364. Nested List Weight SumII

题目:Given a nested list of integers, return the sum of all integers in the list weighted by their depth.Each element is either an integer, or a list -- whose elements may also be integers o

212. Word SearchII

题目:Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells ar

[Algorithm] DFS和Backtracking的区别

DFS BacktrackingTarget Structure Actual Tree/Graph Structure Any type of structure where portions of the domain can be eliminated (Chess Board, matrix, implicit tree) Definition A specific