We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Recursion: Davis' Staircase
- Discussions
Recursion: Davis' Staircase
Recursion: Davis' Staircase
Sort by
recency
|
410 Discussions
|
Please Login in order to post a comment
Python with dynamic programming
Why is n = 0 (base case), the ans is 1 not 0?
Recursion function to avoid TLE :
int solve(int n, int index, vector &dp){
}
int stepPerms(int n) { vectordp(n+1,-1); int ans = solve(n, 0, dp) % mod;
}
O(logN) solution: