https://github.com/parthjohri/dynamicprogramming
This repository contains my code solutions for the dynamic programming problems in C++.
https://github.com/parthjohri/dynamicprogramming
cpp dynamicprogramming
Last synced: 3 months ago
JSON representation
This repository contains my code solutions for the dynamic programming problems in C++.
- Host: GitHub
- URL: https://github.com/parthjohri/dynamicprogramming
- Owner: ParthJohri
- Created: 2023-01-06T21:38:21.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-06T21:39:46.000Z (about 3 years ago)
- Last Synced: 2025-02-25T17:38:53.895Z (about 1 year ago)
- Topics: cpp, dynamicprogramming
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic Programming
## [Fibonacci Series](https://leetcode.com/problems/fibonacci-number/)
```cpp
class Solution {
public:
int fib(int n) {
vector dp(n+5,0);
dp[0]=0;
dp[1]=1;
dp[2]=1;
dp[3]=2;
dp[4]=3;
for(int i=5;i<=n;i++)
dp[i]=dp[i-1]+dp[i-2];
return dp[n];
}
};
```