<reponame>cmattey/leetcode_problems<gh_stars>1-10
# 70. Climbing Stairs
# Time: O(n)
# Space: O(1)

class Solution:
    def climbStairs(self, n: int) -> int:

        if n<=2:
            return n

        first = 1
        second = 2

        for i in range(3,n+1):
            ans = first+second
            first = second
            second = ans

        return ans

# 70. Climbing Stairs
# Time: O(n)
# Space: O(1)

class Solution:
    def climbStairs(self, n: int) -> int:

        if n<=2:
            return n

        first = 1
        second = 2

        for i in range(3,n+1):
            ans = first+second
            first = second
            second = ans

        return ans
# 70. Climbing Stairs # Time: O(n) # Space: O(1)