当前位置:网站首页>剑指 Offer 10- II. 青蛙跳台阶问题
剑指 Offer 10- II. 青蛙跳台阶问题
2022-06-26 23:41:00 【anieoo】
solution:
class Solution {
public:
int numWays(int n) {
if(n <= 1) return 1;
vector<int> dp(n + 1);
dp[0] = 1;
dp[1] = 1;
for(int i = 2;i <= n;i++) {
dp[i] = (dp[i - 1] + dp[i -2]) % 1000000007;
}
return dp[n];
}
};
边栏推荐
- 手机上炒股开户可靠吗 网上开户炒股安全吗
- Would you like to buy stocks? Where do you open an account in a securities company? The Commission is lower and safer
- 国内外最好的12款项目管理系统优劣势分析
- 安利!如何提优质的ISSUE?学霸是这样写的!
- Can't write to avoid killing and can easily go online CS through defender
- 客户端实现client.go客户端类型定义连接
- 买基金在哪里开户买比较安全
- Kubernetes visual interface dashboard
- 1+1<2 ?! HESIC论文解读
- Where is it safer to open an account to buy funds
猜你喜欢

Can't write to avoid killing and can easily go online CS through defender

新型冠状病毒变异Delta毒株的模拟(MindSPONGE应用)

go中的微服务和容器编排

50 tips that unity beginners can definitely use

Crawler and Middleware of go language
![[微服务]Nacos](/img/69/6641e943c4366d5591acdf9e12389c.png)
[微服务]Nacos

深度学习方法求解平均场博弈论问题

Kubeadm create kubernetes cluster

Color matching and related issues

邮箱附件钓鱼常用技法
随机推荐
Big guys talk about the experience sharing of the operation of the cutting-edge mindspore open source community. Come up with a small notebook!
Nacos安装指南
leetcode 1143. Longest common subsequence (medium)
Your connection is not private
安利!如何提优质的ISSUE?学霸是这样写的!
Introduction to message queuing
Lorsque le transformateur rencontre l'équation différentielle partielle
【UVM实战 ===> Episode_3 】~ Assertion、Sequence、Property
Pinpoint attackers with burp
Simple test lightweight expression calculator fly
Common techniques of email attachment phishing
Leetcode skimming 4 Find the median of two positive arrays
My advanced learning notes of C language ----- keywords
In the Internet industry, there are many certificates with high gold content. How many do you have?
leetcode 1143. Longest Commom Subsequence 最长公共子序列(中等)
国产框架MindSpore联合山水自然保护中心,寻找、保护「中华水塔」中的宝藏生命
Is it safe to buy pension insurance online? Is there a policy?
Is it reliable to open an account for stock trading on the mobile phone? Is it safe to open an account for stock trading on the Internet
Where is it safer to open an account to buy funds
The user adds a timer function in the handler () goroutine. If it times out, it will be kicked out