dfs
哎-哭泣的鱼
这个作者很懒,什么都没留下…
展开
-
【九度】题目1418:宝藏
题目描述: Luke 得到一张藏宝图,藏宝图上有n个城市(编号1-n),并且这些城市有一些道路相连着。每个城市里都有一份宝藏,并且宝藏图里已经把每个城市的宝藏位置描述得很清楚了,所以只要Luke能到达这个城市,他就一定能找到这个城市里的那份宝藏。输入: 输入有多组,每组输入第一行为三个整数n,m,s(1输出: 对于每组输入,先输原创 2013-12-25 12:52:56 · 878 阅读 · 0 评论 -
【LeetCode】Permutation Sequence
Permutation Sequence Total Accepted: 3033 Total Submissions: 14751 My SubmissionsThe set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in o原创 2014-01-17 13:48:25 · 2801 阅读 · 0 评论 -
【LeetCode】N-Queens II && 【九度】题目1254:N皇后问题
N-Queens II Total Accepted: 2737 Total Submissions: 10408 My SubmissionsFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.原创 2014-01-15 17:00:20 · 1179 阅读 · 0 评论 -
【LeetCode】Valid Sudoku && Sudoku Solver
1、Valid SudokuTotal Accepted: 5188 Total Submissions: 19186 My SubmissionsDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, whe原创 2014-03-09 15:19:05 · 1336 阅读 · 0 评论 -
【LeetCode】N-Queens && 【九度】题目1140:八皇后
N-Queens Total Accepted: 3171 Total Submissions: 12620 My SubmissionsThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given原创 2014-01-15 16:55:31 · 1407 阅读 · 0 评论 -
【LeetCode】Palindrome Partitioning I&II
原文来自http://blog.csdn.net/yutianzuijin/article/details/16850031leetcodeDP深搜回文串目录(?)[+]Palindrome PartitioningPalindrome Partitioning II深搜DP1 Palindrome Partitioning问题来源:Pa转载 2014-01-13 17:53:45 · 760 阅读 · 0 评论 -
【LeetCode】Permutations && Permutations II
1、Permutations Total Accepted: 6396 Total Submissions: 20594 My SubmissionsGiven a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[原创 2014-01-24 14:34:58 · 2915 阅读 · 0 评论 -
【LeetCode】Sudoku Solver
Sudoku Solver Total Accepted: 20609 Total Submissions: 96910 My Submissions Question Solution Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the原创 2015-02-04 22:54:52 · 820 阅读 · 0 评论 -
【九度】题目1461:Tempter of the bone
题目描述:The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that原创 2013-12-06 21:29:30 · 787 阅读 · 0 评论 -
【LeetCode】Subsets I && II
1、SubsetsTotal Accepted: 7967 Total Submissions: 29509 My SubmissionsGiven a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.原创 2014-03-01 21:42:29 · 1619 阅读 · 0 评论 -
【LeetCode】Combinations && Letter Combinations of a Phone Number
1、Combinations Total Accepted: 8363 Total Submissions: 28177 My SubmissionsGiven two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k =原创 2014-03-20 17:51:19 · 915 阅读 · 0 评论 -
【LeetCode】Palindrome Partitioning
Palindrome Partitioning Total Accepted: 4268 Total Submissions: 17532 My SubmissionsGiven a string s, partition s such that every substring of the partition is a palindrome.Return all possible pal原创 2014-01-14 14:21:50 · 1930 阅读 · 5 评论 -
【LeetCode】Valid Parentheses && Generate Parentheses && Longest Valid Parentheses
这三道题都是括号匹配问题。1、Valid Parentheses Total Accepted: 5225 Total Submissions: 18918 My SubmissionsGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input s原创 2014-01-24 10:46:15 · 1245 阅读 · 0 评论 -
【LeetCode】Letter Combinations of a Phone Number
Letter Combinations of a Phone Number Total Accepted: 4387 Total Submissions: 17627 My SubmissionsGiven a digit string, return all possible letter combinations that the number could represent.A ma原创 2014-01-25 16:11:44 · 2443 阅读 · 0 评论 -
【LeetCode】Restore IP Addresses
Restore IP Addresses Total Accepted: 6682 Total Submissions: 33461 My SubmissionsGiven a string containing only digits, restore it by returning all possible valid IP address combinations.For exa原创 2014-04-12 22:03:59 · 732 阅读 · 0 评论 -
【LeetCode】Path Sum
Path Sum Total Accepted: 5082 Total Submissions: 17224 My SubmissionsGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path eq原创 2014-01-08 14:10:19 · 1027 阅读 · 0 评论 -
【LeetCode】Sum Root to Leaf Numbers
Sum Root to Leaf Numbers Total Accepted: 4893 Total Submissions: 17365 My SubmissionsGiven a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example原创 2014-01-08 00:02:59 · 709 阅读 · 0 评论 -
【LeetCode】Path Sum II
Path Sum II Total Accepted: 4441 Total Submissions: 16502 My SubmissionsGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given th原创 2014-01-08 15:42:41 · 1345 阅读 · 0 评论 -
【LeetCode】Word Search
Word Search Total Accepted: 7113 Total Submissions: 36905 My SubmissionsGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially原创 2014-04-15 19:47:50 · 1882 阅读 · 0 评论 -
【LeetCode】Expression Add Operators
Expression Add Operators My Submissions Question Solution Total Accepted: 1506 Total Submissions: 8547 Difficulty: HardGiven a string that contains only digits 0-9 and a target value, return all原创 2015-09-24 17:19:02 · 3687 阅读 · 0 评论