daily leetcode - pascals-triangle - !
题目地址 https://leetcode.com/problems/pascals-triangle/ 题目描述 Given a non-negative integer numRows , generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it. Example: Input: 5 Output: [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 思路 杨辉三角是二项式系数的一种写法,如果熟悉杨辉三角的五个性质,那么很好生成,可参见我的上一篇博文Pascal's Triangle II。具体生成算是:每一行的首个和结尾一个数字都是 1,从第三行开始,中间的每个数字都是上一行的左右两个数字之和。 关键点解析 代码 class Solution { public: vector<vector<int>> gen....