码迷,mamicode.com
首页 >  
搜索关键字:pascals triangle    ( 1342个结果
Pascal's Triangle 1 & 2
这两题都比较简单,第一题输出杨辉三角,第二题输出特定的某一行,第二题要求空间复杂度为O(k) 代码如下: Pascal's Triangle: public List> generate(int numRows) {//direct simulate List> rs = new LinkedList>(); if(numRows == 0)retur...
分类:其他好文   时间:2015-04-15 14:55:55    阅读次数:135
数学 ACdream 1196 KIDx's Triangle
题目传送门 1 /* 2 这道题花了好长时间AC,思路有,但是表达式少写了括号一直乱码,囧! 3 注意:a==0时要特判:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 ...
分类:其他好文   时间:2015-04-13 22:48:12    阅读次数:135
Pascal's Triangle
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:其他好文   时间:2015-04-13 14:34:42    阅读次数:100
Pascal's Triangle II
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(...
分类:其他好文   时间:2015-04-13 14:32:59    阅读次数:108
[LeetCode] Pascal's Triangle
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:其他好文   时间:2015-04-13 12:26:38    阅读次数:121
Pascal's Triangle II
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(...
分类:其他好文   时间:2015-04-13 12:20:33    阅读次数:101
hdu 4324 Triangle LOVE
拓扑排序,不开心持续中 #include #include #include #include #define maxn 2100 using namespace std; vector >mapp; int head[maxn]; int n; void solve() { queueroot; for(int i=0;i<n;i++) { if(!head[i]) root.pus...
分类:其他好文   时间:2015-04-13 09:31:28    阅读次数:114
LeetCode(118) Pascal's Triangle (Java)
题目如下: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return [      [1],     [1,1],    [1,2,1],   [1,3,3,1],  [1,4,6,4,1] ] 我的代码:...
分类:编程语言   时间:2015-04-12 16:16:46    阅读次数:105
acdream.18.KIDx's Triangle(数学推导)
KIDx's TriangleTime Limit:2000/1000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatisticNext ProblemProblem DescriptionOne day, KID...
分类:其他好文   时间:2015-04-11 14:39:30    阅读次数:118
杨辉三角
int[][] triangle = new int[6][6]; int i, j, k = 0; for (i = 0; i < triangle.length; i++) { triangle[i][0] = 1; triangle[i][i] = 1; } for (...
分类:其他好文   时间:2015-04-10 22:20:16    阅读次数:155
1342条   上一页 1 ... 93 94 95 96 97 ... 135 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!