码迷,mamicode.com
首页 >  
搜索关键字:combination sum    ( 21657个结果
算法 计算多个顺序区间的总长
List list = Arrays.asList(new Point(1, 5), new Point(2, 3),new Point(2, 8), new Point(9, 13));int sum = list.get(0).y - list.get(0).x,currenty=list.ge...
分类:其他好文   时间:2014-06-28 19:25:36    阅读次数:183
【leetcode】Minimum Path Sum
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo...
分类:其他好文   时间:2014-06-28 15:55:58    阅读次数:196
POJ 1155
很久以前做的树形DP题,今天再遇到时,竟然不会了,所以写写。。设数组:prf[MAX][MAX],cost[MAX],sum[MAX]。分别表示,在第i个结点为根的子树内的情况下,若有j个用户申请看电视,所能得到的最大费用。cost表示传送到i点时所花的费用,而sum表示当前结点为根的子树内已访问的...
分类:其他好文   时间:2014-06-28 14:28:23    阅读次数:293
SQL基础语法等
--1、while循环declare @sum intdeclare @i intset @i=1set @sum=0while(@i90) print @iendprint @sum--2、goto语句declare @num intset @num=100flag:print @numsel.....
分类:数据库   时间:2014-06-28 13:30:20    阅读次数:267
函数指针
函数指针是指向函数的指针变量。每一个函数都有一个入口地址,该入口地址就是函数指针所指向的地址。有了指向函数的指针后,可用该指针变量调用函数。函数指针有两个用途:调用函数和做函数的参数。(1)函数指针的声明方法为:函数类型 (标志符指针变量名名) (形参列表);int sum(int a, in...
分类:其他好文   时间:2014-06-28 13:28:18    阅读次数:154
一个数组中找到满足和为sum的两个数
如果考虑hashmap直接O(n)的速度, 如果不行,就先排序,两头指针很好推理,关键是 a[beg] +a[end]>sum,意思就是说a[end]太大了,最小的数的都不满足,所以排除a[end] 绝知此事要躬行 #include#includeusing namespace std; bool ...
分类:其他好文   时间:2014-06-21 07:38:14    阅读次数:187
Leetcode:Triangle 三角形塔最小路径和
Triangle:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, give...
分类:其他好文   时间:2014-06-21 07:02:07    阅读次数:203
Leetcode:Combination Sum
Description:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesame...
分类:其他好文   时间:2014-06-21 06:55:48    阅读次数:200
Leetcode: Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeate...
分类:其他好文   时间:2014-06-20 23:37:29    阅读次数:195
Leetcode Sum Root to Leaf Numbers
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:其他好文   时间:2014-06-20 15:30:19    阅读次数:227
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!