Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-08-05 18:09:19
阅读次数:
168
题目原文:
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of
S is 1000, and there exists one unique longest palindromic substring.
题意解析:
最长回文子串。就是...
分类:
其他好文 时间:
2014-08-05 15:56:59
阅读次数:
290
链接:http://poj.org/problem?id=1679
题意:告诉你有n个点,m条边,以及m条边的信息(起点、终点、权值),判断最小生成树是否唯一
判断MST是否唯一的思路是这样:对于每条边如果有和他相等权值的边,则做一个标记,然后进行一遍kruskal或prim找出最小生成树权值,然后对于每个使用过并且有相等边标记的边,把它从图中删去,再进行一遍kruskal或prim,...
分类:
其他好文 时间:
2014-08-05 14:12:39
阅读次数:
308
Non-unique ElementsYou are given a non-empty list of integers (X). For this task, you should return a list consisting of only the non-unique elements ...
分类:
其他好文 时间:
2014-08-05 10:48:49
阅读次数:
210
问题:n个结点总共有多少个二叉搜索树分析:n=1,sum1=1 n=2,sum2=2; n=3,sum3=2(头结点为1)+1(头结点为2)+2(头结点为3) n=4,sum4=5(头结点为1,sum3)+2(头结点为2,sum1*sum2)+2(头结点为3,sum2*sum1)+...
分类:
其他好文 时间:
2014-08-04 13:53:47
阅读次数:
193
题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo....
分类:
编程语言 时间:
2014-08-04 04:10:26
阅读次数:
374
最小生成树的唯一性,POJ 1679 The Unique MST...
分类:
其他好文 时间:
2014-08-03 10:19:25
阅读次数:
261
The Unique MST
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 20293
Accepted: 7124
Description
Given a connected undirected graph, tell if its minimum spa...
分类:
其他好文 时间:
2014-08-02 20:58:54
阅读次数:
362
问题:从起点到终点总共有多少条路径分析:f[x,y]=f[x+1,y]+f[x,y+1],用记忆化搜索就可以解决了class Solution {public: int num[110][110]; int dfs(int m,int n,int x,int y) { ...
分类:
其他好文 时间:
2014-08-02 20:39:33
阅读次数:
165
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 1
\ ...
分类:
其他好文 时间:
2014-08-02 15:34:34
阅读次数:
221