aboutsummaryrefslogtreecommitdiff
path: root/challenge-112/stuart-little/python/ch-2.py
blob: 041baec0a040224969d455eb1de43fcd75191619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

# run <script> <number>

import sys

memo = [
    [[1,],],
    [[1,1],[2,]],
]

def memoSteps(n):
    if (n > len(memo)-1):
        memo.append([*(map(lambda a: [1,*a], memoSteps(n-1))),*(map(lambda a: [2,*a], memoSteps(n-2)))])
    return memo[n]

res = memoSteps(int(sys.argv[1])-1)
print(f"""{len(res)}
{'-' * 12}""")
for ar in res:
    print(ar)