Skip to content
Veltoryx Technologies
ProProblem 68● EasyLeetCode #70 ↗4 min readUpdated 30 October 2026

Climbing Stairs

Calculate the number of distinct ways to climb a staircase of n steps taking 1 or 2 steps at a time using memoized recursion.

01The problem

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?

InputOutputWhy
n = 221+1 or 2 steps
n = 331+1+1, 1+2, or 2+1 steps
n = 455 distinct step combinations

Constraints: 1 <= n <= 45.

Loading the rest of the lesson…