You are viewing a single comment's thread. Return to all comments →
Python with dynamic programming
def stepPerms(n, memo=None): if memo is None: memo = [None] * (n + 1) if n == 0: return 1 if n < 0: return 0 if memo[n] is None: memo[n] = stepPerms(n-1, memo) + stepPerms(n-2, memo) + stepPerms(n-3, memo) return memo[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 →
Python with dynamic programming