Dynamic Programming • Easy

Climbing Stairs

You are climbing a staircase. It takes `n` steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

The Challenge

You are climbing a staircase. It takes `n` steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Difficulty Easy
Topic Dynamic Programming

Pro-tip: This is essentially the Fibonacci sequence. The number of ways to reach step `n` is `ways(n-1) + ways(n-2)`.

Solution.swift Tests.swift
Output
Ready to run.