📜  最宏伟的楼梯 foobar 解决方案 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:05.820000             🧑  作者: Mango

代码示例1
def solution(n):
    m = [[0 for i in range(n + 1)] for j in range(n + 1)]
    m[0][0] = 1  # base case
    for stair in range(1, n + 1):
        for left in range(0, n + 1):
            m[stair][left] = m[stair - 1][left]
            if left >= stair:
                m[stair][left] += m[stair - 1][left - stair]
                  
    return m[n][n] -1