You are viewing a single comment's thread. Return to all comments →
here is another java solution using dynammic programming
static int stepPerms(int n) { if(n==1) { return 1; } int[] m = new int[n+1]; m[0] = 1; return helper(n,m); } private static int helper(int n, int[] m) { if(n<0) { return 0; } if(m[n]!=0) { return m[n]; } if(n==1) { return 1; } m[n] = helper(n-3,m) + helper(n-2,m) + helper(n-1,m); return m[n]; }
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 →
here is another java solution using dynammic programming