当前位置:网站首页>118. Yanghui triangle (dynamic planning)
118. Yanghui triangle (dynamic planning)
2022-06-12 17:39:00 【Yangpengwei】
Given a nonnegative integer numRows, Generate 「 Yang hui triangle 」 Before numRows That's ok . stay 「 Yang hui triangle 」 in , Each number is the sum of the numbers at the top left and right of it .
Ideas : The above topic has told us that this is a dynamic planning topic .
class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ret(numRows);
for (int i = 0; i < numRows; ++i) {
ret[i].resize(i + 1);
ret[i][0] = ret[i][i] = 1;
for (int j = 1; j < i; ++j) {
ret[i][j] = ret[i - 1][j] + ret[i - 1][j - 1];
}
}
return ret;
}
};边栏推荐
- Interesting LD_ PRELOAD
- Cesium parabolic equation
- Codeforces Round #398 (Div. 2) D. Cartons of milk
- 406. 根据身高重建队列
- 分辨率与行场同步信号的关系 场消隐
- Tcp/ip family structure and protocol of tcp/ip series overview
- The R language uses the tablestack function of epidisplay package to generate statistical analysis tables based on grouped variables (including descriptive statistical analysis, hypothesis test, diffe
- The R language uses the plot function to visualize the data scatter chart, and uses font The axis parameter specifies that the font type of the axis scale label is italic
- Volcano engine held a video cloud technology force summit and released a new experience oriented video cloud product matrix
- Deep interest evolution network for click through rate prediction
猜你喜欢

Cicada mother talks to rainbow couple: 1.3 billion goods a year, from e-commerce beginners to super goods anchor

多种Qt的开发方式,你选择哪种?
![Vulnhub[DC3]](/img/3a/1aa03e804d447d38e85807928fdb8f.png)
Vulnhub[DC3]

内核中断整体流程图

Arm64栈回溯

借助SpotBugs将程序错误扼杀在摇篮中

Arm64 Stack backtrack

JDBC几个坑

Fiddler抓包几种常用功能介绍(停止抓包、清空会话窗内容、过滤请求、解码、设置断点......)

Introduction to several common functions of fiddler packet capturing (stop packet capturing, clear session window contents, filter requests, decode, set breakpoints...)
随机推荐
多种Qt的开发方式,你选择哪种?
Sizepolicy policy in layout management
5-5配置Mysql复制 基于日志点的复制
R语言使用epiDisplay包的summ函数计算dataframe中指定变量在不同分组变量下的描述性统计汇总信息并可视化有序点图(名称、有效值个数、均值、中位数、标准差、最大值、最小值)
Cesium parabolic equation
SqlServer常用语句及函数
Cicada mother talks to rainbow couple: 1.3 billion goods a year, from e-commerce beginners to super goods anchor
Some introduction to FPC flexible circuit board design
Risc-v ide mounriver studio v1.60 update point introduction
WinForm, crystal report making
Unprecedented analysis of Milvus source code architecture
Two ways of tensorflow2 training data sets
Dongfeng Yueda Kia, Tencent advertising and hero League mobile game professional league cooperate to build a new E-sports ecology
First acquaintance with go language
MySQL authorization summary
Are Huishang futures accounts reliable? Is the fund safe?
Saturated! Can't future programmers work anymore?
Selenium element positioning
Tensorflow reads data from the network
Use GCC's PGO (profile guided optimization) to optimize the entire system