第三道还是帕斯卡三角,这个是要求正常输出,题目如下:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5, Return[ [1], [1,1], ...
分类:
其他好文 时间:
2014-11-11 10:32:32
阅读次数:
191
我是按难度往下刷的,第二道是帕斯卡三角形二。简单易懂,题目如下: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 y...
分类:
其他好文 时间:
2014-11-11 01:58:05
阅读次数:
242
In geometry the Fermat point of a triangle, also called Torricelli point, is a point such that the total distance from the three vertices of the trian...
分类:
其他好文 时间:
2014-11-10 21:14:40
阅读次数:
269
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(...
分类:
其他好文 时间:
2014-11-09 23:25:25
阅读次数:
219
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]...
分类:
其他好文 时间:
2014-11-09 22:10:07
阅读次数:
186
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 fol...
分类:
其他好文 时间:
2014-11-09 13:54:18
阅读次数:
155
题目意思:
给出一个数字三角形,计算从头走到尾的数字之和的最大值。规定只能向下向右下走。
http://poj.org/problem?id=1163
题目分析:
简单DP,动态转化方程:dp[i][j]=max(dp[i+1][j],dp[i+1][j+1])+a[i][j].从下到上进行dp
AC代码:
#include
using namespace std;
i...
分类:
其他好文 时间:
2014-11-08 23:42:45
阅读次数:
329
Description
You have a piece of iron wire with length of n unit. Now you decide to cut it into several ordered pieces and fold each piece into a triangle satisfying:
*All triangles are integral....
分类:
其他好文 时间:
2014-11-08 23:40:43
阅读次数:
396
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...
分类:
其他好文 时间:
2014-11-08 10:26:18
阅读次数:
173
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,...
分类:
其他好文 时间:
2014-11-08 10:23:23
阅读次数:
194