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 following triangle
[
[2],
[3,4],
[...
分类:
其他好文 时间:
2014-10-01 19:09:51
阅读次数:
144
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]
]
class Solution {
public:
...
分类:
其他好文 时间:
2014-10-01 19:09:11
阅读次数:
130
本文内容收集来自网络#triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom:...
分类:
Web程序 时间:
2014-09-30 18:51:59
阅读次数:
162
虽说题目很简单,也没有优化。但是depend on myself & 一遍就AC还是很让人开心的。。之前二维vector不熟,通过这个题熟了很多。时间复杂度O(n^2),空间复杂度O(n^2). 优化之后可以做到空间复杂度O(1), 见代码2. 1 #include 2 #include 3 #.....
分类:
其他好文 时间:
2014-09-30 09:40:32
阅读次数:
200
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-09-29 22:48:21
阅读次数:
163
题意:在圆上取n个点,相邻两个点之间连线,(注意,n和1相邻),然后所有点对(i ,i+2)相连,问能形成的不同的三角形有多少个?思路:找规律 n=3,cnt=1; n=4,cnt=8; n=5 cnt=35 (5*2+5*2+ 5+5+5); n=6 cnt= 32 ...
分类:
其他好文 时间:
2014-09-29 19:28:31
阅读次数:
149
POJ 3146 & HDU 3304 Interesting Yang Yui Triangle(杨辉三角)...
分类:
其他好文 时间:
2014-09-25 18:43:52
阅读次数:
218
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-09-24 19:50:27
阅读次数:
183
Leetcode 水题 杨辉三角 或者 Pascal's Triangle...
分类:
其他好文 时间:
2014-09-23 00:43:43
阅读次数:
218
写一个程序,定义抽象基类Shape,由它派生出3个派生类,Circle(圆形)、Rectangle(矩形)、Triangle(三角形)。用如下的main()函数,求出定义的几个几何体的面积和
程序代码
#include
using namespace std;
class CSolid//立方体类
{
public:
//计算立方体的表面积
virtual d...
分类:
其他好文 时间:
2014-09-23 00:31:16
阅读次数:
370