Developer

This experience deserves a bigger screen

The DSA Visualizer is designed for deep focus,
side-by-side code, and real-time execution insight.

On small screens, that level of clarity can't be preserved.

Open on a tablet (landscape) or desktop for the intended experience.

Desktop experience preview

Climbing StairsStep-by-Step Visualization

A simple yet powerful introduction to DP, equivalent to the Fibonacci sequence.

Problem Statement

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?

Approach

DP: Ways(n) = Ways(n-1) + Ways(n-2). Base cases: Ways(1)=1, Ways(2)=2. We can optimize space to O(1) by storing only the last two values.

Time & Space Complexity

Time complexity is O(n). Space complexity is O(1).

Interactive Visualization

Loading Interactive Visualizer...

Click "Play" or use arrow keys to step through the execution.