You are viewing a single comment's thread. Return to all comments →
int stepPerms(int n) {
vector<int> dp= {1,1,2,4}; for(int i=4;i<n+1;i++){ dp.push_back((dp[i-3]%MOD + dp[i-2]%MOD +dp[i-1]%MOD)%MOD); } return dp[n];
}
using bottom up approach
Seems like cookies are disabled on this browser, please enable them to open this website
Recursion: Davis' Staircase
You are viewing a single comment's thread. Return to all comments →
define MOD 10000000007
int stepPerms(int n) {
}
using bottom up approach