70. 爬楼梯

class Solution:
    def climbStairs(self, n):
        """
        :type n: int
        :rtype: int
        """
        condition = [0] * (n + 1)
        condition[0] = 1
        condition[1] = 1
        for i in range(2, n+1):
            condition[i] = condition[i-1] + condition[i-2]
        return condition[n]

相关文章:

  • 2021-08-09
  • 2021-08-18
  • 2021-09-10
  • 2021-05-03
  • 2021-05-03
  • 2021-10-24
猜你喜欢
  • 2021-06-28
  • 2021-12-21
  • 2021-09-29
相关资源
相似解决方案