当前位置:网站首页>剑指 Offer 10- I. 斐波那契数列
剑指 Offer 10- I. 斐波那契数列
2022-06-25 15:32:00 【anieoo】

solution:
动态规划
class Solution {
public:
int fib(int n) {
if(n < 2) return n;
vector<int> dp(n + 1);
dp[0] = 0;
dp[1] = 1;
for(int i = 2;i <= n;i++) {
dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007;
}
return dp[n];
}
};边栏推荐
- Semaphore function
- Day01: learning notes
- Software packaging and deployment
- 股票开户用什么app最安全?知道的给说一下吧
- Design and implementation of thread pool
- Brain tree (I)
- [paper notes] street view change detection with deconvolutional networks
- Learning to Measure Changes: Fully Convolutional Siamese Metric Networks for Scene Change Detection
- Js- get the mouse coordinates and follow them
- Agent and classloader
猜你喜欢
![[paper notes] mcunetv2: memory efficient patch based influence for tiny deep learning](/img/4b/f446bd37057237c0ba4c7b4e38e74f.jpg)
[paper notes] mcunetv2: memory efficient patch based influence for tiny deep learning

Js- get the mouse coordinates and follow them

CPU over high diagnosis and troubleshooting

Source code analysis of synergetics and ntyco

Why do I need message idempotence?

MySQL field truncation principle and source code analysis

Paddlepaddle paper reproduction course biggan learning experience

Learning C language today is the first time to learn C language. In college, C linguistics is not good, but I want to make progress, so I found a beep video on the Internet to learn C language

到底要不要去外包公司?这篇带你全面了解外包那些坑!

Distributed token
随机推荐
[paper notes] rethinking and improving relative position encoding for vision transformer
Weka download and installation
Afterword of Parl intensive learning 7-day punch in camp
Go language modifies / removes multiple line breaks in strings
Generic - learning notes
QT source code online view
Breakpad usage and DMP analysis
Data preprocessing - normalization and standardization
iconv_ Open returns error code 22
Distributed token
Generation method and usage of coredump
Netlogo learning
How to download and install Weka package
Kali modify IP address
What is the safest app for stock account opening? Tell me what you know
剑指 Offer II 091. 粉刷房子
Globally unique key generation strategy - implementation principle of the sender
Postman usage notes, interface framework notes
Data feature analysis skills - correlation test
Basic syntax and common commands of R language