一.fpc安装 1. 下载:http://www.freepascal.org/down/i386/win32.var(或者:http://download.csdn.net/detail/wenph2008/8916963) 2. 安装:双击安装 3. 写一个測试代码:pascal_test.pas在桌面 4. 測试编译:成功! 5. 执行:成功! 6. 加环境变量 右键"我的电脑"->"属性"->"高级系统设置"->&quo…
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, given the following triangle [ [], [,4], [6,,7], [4,,8,3] ] The minimum path sum from top to bottom is…
1.题目描述 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] ]   2.解法分析 这个题目很简单,所以不需要额外的解说,一遍就AC了 class Solution { public: vector<vector<int> >…
Little Sub is about to take a math exam at school. As he is very confident, he believes there is no need for a review. Little Sub's father, Mr.Potato, is nervous about Little Sub's attitude, so he gives Little Sub a task to do. To his surprise, Littl…
我是按难度往下刷的,第二道是帕斯卡三角形二.简单易懂,题目如下: 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? 就是输入k然后输出第k行帕斯卡三角[其实我一直把它叫杨辉三角]. 我这边思路是拿…
Little Sub is about to take a math exam at school. As he is very confident, he believes there is no need for a review. Little Sub's father, Mr.Potato, is nervous about Little Sub's attitude, so he gives Little Sub a task to do. To his surprise, Littl…
题目: 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? 代码:oj测试通过 Runtime: 48 ms class Solution: # @return a list of integers d…
题目: 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] ] 代码:oj测试通过 Runtime: 46 ms class Solution: # @return a list of lists of integers def generate(self…
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41851069 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 spac…
三角形(Triangle) 问题 给出一个三角形,找出从顶部至底部的最小路径和.每一步你只能移动到下一行的邻接数字. 例如,给出如下三角形: [ [2], [3,4], [6,5,7], [4,1,8,3] ] 从顶部至底部的最小路径和为11(即2+3+5+1=11). 注意: 加分项-如果你能只使用O(n)的额外空间,n为三角形中的总行数. 初始思路 最直接的思路就是把路径都走一遍.即从顶点出发,分别往左中右移动(如果可能的话):然后对走到的位置继续进行同样移动,直到走到最后一行.这样就可以得…