Skip to content

This repository contains my code solutions for the dynamic programming problems in C++.

Notifications You must be signed in to change notification settings

ParthJohri/DynamicProgramming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Dynamic Programming

class Solution {
public:
    int fib(int n) {
        vector<int> 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];
    }
};

About

This repository contains my code solutions for the dynamic programming problems in C++.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published