You are viewing a single comment's thread. Return to all comments →
approach is very nice. I tried to implement your approach same as you mentioned.
def stepPerms(n): if (n == 1): return 1 elif (n == 2): return 2 elif (n == 3): return 4 else: return (stepPerms(n-1) + stepPerms(n-2) + stepPerms(n-3)) % 10000000007
but it is getting TLE for test case 5 to 8. So what's the way to solve this?
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 →
approach is very nice. I tried to implement your approach same as you mentioned.
but it is getting TLE for test case 5 to 8. So what's the way to solve this?