You are viewing a single comment's thread. Return to all comments →
Java Solution (Recursion +DP)
static long dp[] = new long[37]; static long M = 10000000007L; public static long stepPerms(int n) { if(n<3)return n; if(n==3)return 4; if(dp[n]>0)return dp[n]; long ans=(stepPerms(n-1)+stepPerms(n-2)+stepPerms(n-3))%M; dp[n] = ans; return ans; }
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 →
Java Solution (Recursion +DP)