Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3,
Return [1,3,3,1].Note:
Could you optimize your algorithm to use only O(k) extra space?分析:通过递归设置vector的值,变量i表示当前...
分类:
其他好文 时间:
2015-06-09 13:51:09
阅读次数:
96
题目链接 题目要求: 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 exam...
分类:
其他好文 时间:
2015-06-09 13:25:22
阅读次数:
102
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]
]分析:
第j=0列全为1,第j==i列时,都为1
其它列
a[2][1]...
分类:
其他好文 时间:
2015-06-09 10:06:02
阅读次数:
132
题目来自于Leetcode
https://leetcode.com/problems/pascals-triangle/
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],...
分类:
其他好文 时间:
2015-06-09 00:57:01
阅读次数:
158
题目: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...
分类:
其他好文 时间:
2015-06-09 00:51:13
阅读次数:
122
题目: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 onl...
分类:
其他好文 时间:
2015-06-09 00:45:04
阅读次数:
115
1 class Solution { 2 public: 3 vector getRow(int rowIndex) { 4 vector> tri; 5 if(rowIndex==0) 6 { 7 vector c;...
分类:
其他好文 时间:
2015-06-08 23:09:21
阅读次数:
133
【称号】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, given the...
分类:
其他好文 时间:
2015-06-08 19:07:41
阅读次数:
85
题目地址:POJ 2954
题意:给出三角形的三个顶点,求内部格点的个数。
思路:形同POJ 1265。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long ...
分类:
其他好文 时间:
2015-06-08 14:59:03
阅读次数:
91
转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063?viewmode=contents题目链接:http://poj.org/problem?id=1163---------------------------------------...
分类:
其他好文 时间:
2015-06-08 13:22:28
阅读次数:
110