题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele...
分类:
其他好文 时间:
2014-10-03 01:34:13
阅读次数:
480
[leetcode]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-10-02 13:30:42
阅读次数:
217
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.
面DP题的考官都是神经病。。(吐...
分类:
其他好文 时间:
2014-10-01 13:15:31
阅读次数:
242
本文介绍的STL算法中的remove删除算法,源码中介绍了函数remove、remove_copy、remove_if、remove_copy_if、unique、unique_copy。并对这些函数的源码进行详细的剖析,并适当给出使用例子。...
分类:
其他好文 时间:
2014-09-30 22:59:30
阅读次数:
351
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-09-30 17:19:19
阅读次数:
173
The feeling of depending on oneself and AC is just great. 1 #include 2 #include 3 using namespace std; 4 class Solution { 5 public: 6 int unique...
分类:
其他好文 时间:
2014-09-30 13:02:29
阅读次数:
190
江苏就是江苏啊,题目质量高。看到题的时候只YY出了第一个性质:MST中边权相同的的边的个数是一定的。(证略,可以用反证法)后来上网找题解,发现还有第二个性质:MST如果用Kruskal来做,做完长度为x的所有边以后,此时图的连通性是确定的。(这也是很明显的)于是嘛。。。先算出每个长度的边的cnt,然...
分类:
Web程序 时间:
2014-09-30 09:42:12
阅读次数:
313
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.
去网上搜n个二叉搜索树的递推公式或者Catalan数,可以由h(n)=C(2n,n)/(n+1)得到h(n)=[2n*(2n-1)*...(n+2)]/[n!]....
分类:
其他好文 时间:
2014-09-29 17:57:01
阅读次数:
171
题意:给出一个距离矩阵,问是不是一颗正确的带权树。解法:先按找距离矩阵建一颗最小生成树,因为给出的距离都是最短的点间距离,然后再对每个点跑dfs得出应该的dis[][],再对比dis和原来的mp是否一致即可。首先还要判断一些东西。具体看代码吧。代码:#include #include #includ...
分类:
其他好文 时间:
2014-09-29 14:43:01
阅读次数:
228
PD中建CDM模型,一个Diagram中有两张表,字段不能重复? 工具-model options-model settings 去掉data item 下的unique code 还有一个"Allow reuse"复选框,建议把这个钩也去掉,那么以后就不要担心在模型里发生...
分类:
其他好文 时间:
2014-09-29 11:36:11
阅读次数:
392