Problem Description:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Solution: 递归。 1 public List>...
分类:
其他好文 时间:
2014-07-07 16:59:12
阅读次数:
169
Problem Description: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 th...
分类:
其他好文 时间:
2014-07-07 16:20:26
阅读次数:
216
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2-...
分类:
其他好文 时间:
2014-07-07 16:17:00
阅读次数:
139
Problem Description:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ...
分类:
其他好文 时间:
2014-07-07 16:02:55
阅读次数:
259
The operators we have seen so far are all special characters like + and *, but there are a few operators that are words. in is a boolean operator that...
分类:
其他好文 时间:
2014-07-07 15:39:31
阅读次数:
246
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
分类:
其他好文 时间:
2014-07-07 14:48:39
阅读次数:
160
Given a set of distinct integers, S, return all possible subsets.
分类:
其他好文 时间:
2014-07-07 14:31:24
阅读次数:
164
搭建一个最小代价的网络,最原始的最小生成树的应用。
这里使用Union find和Kruskal算法求解.
注意:
1 给出的数据是原始的矩阵图,但是需要转化为边表示的图,方便运用Kruskal,因为需要sort
2 减少边,一个矩阵最多需要(N*N-N)>>1条边,有人讨论本题是否有向,那是无意义的,因为本题的最小生成树和方向无关。
3 使用Union find是为了判断是否有环,比原...
分类:
Web程序 时间:
2014-06-30 08:10:08
阅读次数:
200
题目
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-que...
分类:
其他好文 时间:
2014-06-30 00:34:18
阅读次数:
188