码迷,mamicode.com
首页 >  
搜索关键字:unique paths    ( 5916个结果
MongoDB索引管理
虽然MongoDB的索引在存储结构上都是一样的,但是根据不同的应用层需求,还是分成了唯一索引(unique)、稀疏索引(sparse)、多值索引(multikey)等几种类型。唯一索引唯一索引在创建时加上 unique:true 的选项即可,创建命令如下:db.users.ensureIndex({...
分类:数据库   时间:2014-07-24 21:37:42    阅读次数:299
【leetcode刷题笔记】3Sum
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:Elemen...
分类:其他好文   时间:2014-07-24 21:24:16    阅读次数:296
UVa10000_Longest Paths(最短路SPFA)
解题报告 求最长路。 用SPFA求最长路,初始化图为零,dis数组也为零 #include #include #include #include #include #define inf 99999999 #define N 110 using namespace std; int mmap[N][N],dis[N],vis[N],n; void spfa(int s) { ...
分类:其他好文   时间:2014-07-24 17:43:16    阅读次数:280
uva 11572 - Unique Snowflakes(与书上方法略有不同)
刘汝佳书上用的是set, 通过集合来查找.count()和删除.erase().这个方法比我的要好,用时更短。 我觉得map也能完成这个任务,但是其删除并不方便,需要先查找find()下标,然后删除此下标对应的元素 但是map有map的用法,下面的方法就是比较容易实现的一种方法。 我本想着这个一边读完就计算出了ans,应该更快一点的,但是事实上还不如先读再用set处理来得快。 #incl...
分类:其他好文   时间:2014-07-24 17:36:36    阅读次数:227
【LeetCode】【Python题解】Unique Binary Search Trees
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-07-24 11:35:42    阅读次数:245
Unique Paths II
这题在Unique Paths的基础上增加了一些obstacle的位置,应该说增加的难度不大,但是写的时候对细节的要求多了很多,比如,第一列的初始化会受到之前行的第一列的结果的制约。另外对第一行的初始化,也要分if else赋值。很容易出现初始化不正确的情况。 代码: class Solut...
分类:其他好文   时间:2014-07-24 05:06:08    阅读次数:221
[leetcode]Permutation Sequence
Permutation SequenceThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the fo...
分类:其他好文   时间:2014-07-23 22:11:47    阅读次数:327
SVN问题:Cleanup failed to process the following paths: xxxxxx
做法:  1、在同一目录下,备份一份; 2、在备份的目录下update下; 3、在步骤2没有问题的前提下,删除原先的文件夹(文件); 4、修改下备份的文件夹的名称,改为原先的; 至此,一切OK~...
分类:Windows程序   时间:2014-07-23 13:24:26    阅读次数:333
[ACM] POJ 1942 Paths on a Grid (组合)
解题思路: 简单题,求解 C(n+m, m) . 代码: #include #include using namespace std; long long c(long long n,long long m) { long long ans=1; for(int i=1;i<=m;i++) ans=ans*(n--)/i; return ans;...
分类:其他好文   时间:2014-07-23 13:18:27    阅读次数:234
【leetcode刷题笔记】Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm...
分类:其他好文   时间:2014-07-22 22:32:33    阅读次数:247
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!