Skip to content

Files

Latest commit

a4a7bb2 · Aug 4, 2018

History

History

ClimbingStairs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Aug 4, 2018
Jun 2, 2018
Jun 2, 2018
Jun 2, 2018

Climbing Stairs

This problem is easy to solve by recursive like below:

class Solution(object):
    def climbStairs(self, n):
        """
        :type n: int
        :rtype: int
        """
        if n == 1:
            return 1
        if n == 2:
            return 2
        return self.climbStairs(n - 1) + self.climbStairs(n - 2)