![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
文章平均质量分 79
算法鱼
这个作者很懒,什么都没留下…
展开
-
Leetcode上和DFS有关题目整理 (内含目录)
总结一下Leetcode上一些比较经典的利用dfs思路解的题:按照顺序排了一下,如果从第一道题一直做到最后一道题,会对dfs有一个新的认识。我们从最典型的开始,首先是关于数字集合的问题,例如输出所有子集,所有序列,我们把这些题当作dfs的基础。Subset I, IICombinationPermutation I, IICombination Co原创 2013-06-24 08:07:00 · 43369 阅读 · 1 评论 -
Leetcode Sudoku Solver
Write 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 puzzle...原创 2013-06-24 08:35:21 · 5458 阅读 · 3 评论 -
Leetcode: N Queen I & II
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. Each原创 2013-06-24 08:33:15 · 8522 阅读 · 2 评论 -
Leetcode Combination Sum I & II
Problem 1: Combination Sum IGiven 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 c原创 2013-06-24 08:20:15 · 3964 阅读 · 1 评论 -
Leetcode: Combination 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原创 2013-06-24 08:24:52 · 2702 阅读 · 0 评论 -
Leetcode Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region .For example,X X X XX O O XX原创 2013-06-24 08:30:25 · 3570 阅读 · 4 评论 -
Leetcode Restore IP Address
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"].(Order d原创 2013-06-24 08:26:37 · 11053 阅读 · 3 评论 -
Leetcode 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: "((()))", "(()())", "(())()", "()(())", "()()()"原创 2013-06-24 08:23:13 · 4888 阅读 · 1 评论 -
Leetcode Permutation I & II
Problem 1: Permutation IGiven 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 [原创 2013-06-24 08:14:59 · 5292 阅读 · 1 评论 -
Leetcode Subset I & II
Problem 1: Subset IGiven a set of distinct integers, S, return all possible subsets.Note: Elements in a subset must be in non-descending order. The solution set must not contain duplicate subs原创 2013-06-24 08:10:13 · 18808 阅读 · 4 评论 -
Leetcode Maximum SubArray & Binary Tree Maximum Path Sum
发现这两道题运用了同一个思路,把它们放到一起Problem: Maximum SubArray Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−原创 2013-07-02 03:31:58 · 2907 阅读 · 3 评论 -
Leetcode: Palindrome Partitioning I & II
Problem I : Palindrome Partitioning I Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For exam原创 2013-06-26 14:08:36 · 5590 阅读 · 2 评论 -
Leetcode上几道Binary Search题需要注意的地方
Binary Search的原理很容易理解,但是每次脚标没算对弄得溢出或是死循环的时候总是很恼火。今天就把Leetcode上几道经典的利用Binary Search解的题放在一起来感受一下。一般有几个比较容易迷糊的地方,·1. 终止条件不同 是取 start 2. 分半的时候是取mid, mid - 1, 还是mid + 1 (这里mid含义对应数组的index, 如果涉及到原创 2013-06-30 17:10:38 · 3600 阅读 · 0 评论