You are viewing a single comment's thread. Return to all comments →
Python
def legoBlocks(n, m): f = [1] g = [1] h = [1] for i in range(1, m + 1): sumhg = 0 for j in range(1, i): sumhg += h[j] * g[i-j] % (10**9+7) f.append(sum(f[-4:]) % (10**9+7)) g.append(f[i] ** n % (10**9+7)) h.append((g[i] - sumhg) % (10**9+7)) return h[-1] % (10**9+7)
Seems like cookies are disabled on this browser, please enable them to open this website
Lego Blocks
You are viewing a single comment's thread. Return to all comments →
Python