Skip to content

Commit

Permalink
Create staircase.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolan Emirot committed Mar 10, 2019
1 parent bebfc55 commit 31ea62b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions algo/cracking_coding_interview/staircase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/python3

import math
import os
import random
import re
import sys
from functools import lru_cache

# Complete the stepPerms function below.
@lru_cache(maxsize=128)
def stepPerms(n):
if n < 0:
return 0
if n == 0 or n == 1:
return 1
return stepPerms(n-1) + stepPerms(n-2) + stepPerms(n-3)

0 comments on commit 31ea62b

Please sign in to comment.