DFS
文章平均质量分 74
cgdong2014
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Word Ladder II
Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be changed at a timeEach intermediate word must exi原创 2014-12-30 09:46:11 · 346 阅读 · 0 评论 -
Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For example: Given the following binary tree, 1原创 2015-08-02 10:46:20 · 212 阅读 · 0 评论 -
Sudoku Solver
rite a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'. You may assume that there will be only one unique solution. A sudoku原创 2015-03-10 09:38:06 · 295 阅读 · 0 评论 -
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: "((()))", "(()())", "(())()", "()(())", "()()()"原创 2015-01-06 04:26:00 · 272 阅读 · 0 评论 -
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 n原创 2015-01-05 10:25:08 · 271 阅读 · 0 评论 -
Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string原创 2015-01-21 08:04:54 · 263 阅读 · 0 评论 -
Word Break II
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, given s = "原创 2014-09-22 03:56:14 · 542 阅读 · 0 评论 -
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. For example, given s = "aab", Return [ ["aa","原创 2014-09-22 11:36:52 · 252 阅读 · 0 评论 -
Permutations
Given a collection of 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], and [3,2,1]. 思原创 2014-10-18 12:57:22 · 292 阅读 · 0 评论 -
Permutations II
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], and [2,1,1].原创 2014-12-31 09:05:18 · 269 阅读 · 0 评论 -
Subsets II
Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not contain duplica原创 2014-10-15 08:24:04 · 320 阅读 · 0 评论 -
Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in the combinati原创 2014-12-26 13:52:55 · 248 阅读 · 0 评论 -
Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number原创 2014-12-26 13:50:18 · 248 阅读 · 0 评论 -
Combinations
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], ]原创 2015-01-11 08:30:44 · 321 阅读 · 0 评论 -
Word Search II
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 are those horiz原创 2015-08-03 23:57:38 · 254 阅读 · 0 评论
分享