Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?
分类:
其他好文 时间:
2014-07-10 11:10:26
阅读次数:
302
mysql "ON DUPLICATE KEY UPDATE" 语法如果在INSERT语句末尾指定了ON DUPLICATE KEY UPDATE,并且插入行后会导致在一个UNIQUE索引或PRIMARY KEY中出现重复值,则在出现重复值的行执行UPDATE;如果不会导致唯一值列重复的问题,则插入...
分类:
其他好文 时间:
2014-07-03 09:34:37
阅读次数:
233
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2014-07-02 22:13:23
阅读次数:
191
1、对象里面的key不区分出stringvar a={};a[1]="a";a["1"]=2;console.log(a); 2、扩展Array原型,编写一个去除数组重复项的方法// 算法一,两层循环,性能差Array.prototype.unique = function(){ var l...
分类:
Web程序 时间:
2014-07-01 20:55:37
阅读次数:
270
//扩展Array原型,编写一个去除数组重复项的方法// 算法一,两层循环,性能差Array.prototype.unique = function(){ var len = this.length, i; // 两两比较(数组长度大于1) while ( --len > 0 ) ...
分类:
其他好文 时间:
2014-07-01 20:46:35
阅读次数:
229
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-06-30 22:43:45
阅读次数:
294
原始指针:通过new建立的*指针智能指针:通过智能指针关键字(unique_ptr, shared_ptr ,weak_ptr)建立的指针在现代 C++ 编程中,标准库包含智能指针,该指针用于确保程序不存在内存和资源泄漏且是异常安全的。在现代 C++ 中,原始指针仅用于范围有限的小代码块、循环或者性...
分类:
编程语言 时间:
2014-06-30 13:49:42
阅读次数:
354
搭建一个最小代价的网络,最原始的最小生成树的应用。
这里使用Union find和Kruskal算法求解.
注意:
1 给出的数据是原始的矩阵图,但是需要转化为边表示的图,方便运用Kruskal,因为需要sort
2 减少边,一个矩阵最多需要(N*N-N)>>1条边,有人讨论本题是否有向,那是无意义的,因为本题的最小生成树和方向无关。
3 使用Union find是为了判断是否有环,比原...
分类:
Web程序 时间:
2014-06-30 08:10:08
阅读次数:
200
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-06-29 20:28:58
阅读次数:
183
题目
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example,
[1,1,2] have the following unique permutations:
[1,1,2], [1,2,1],
...
分类:
其他好文 时间:
2014-06-27 23:53:21
阅读次数:
290