recursion visualizer · leetcode 104

maxDepth(root) — maximum depth of a binary tree

primary: structure traversal secondary: value-combining 1 call per node + 1 per empty slot

Input changing this re-runs the trace from step 0

Playback ← / → to step, space to play

step 0 depth 0 max depth 0 calls 0 answer

What just happened

READY
Press Forward to make the first call.

Source plain version

The tree itself the data being walked

visited

Call stack newest on top

Recursion tree one node per call · grows in call order

active on current path closed (returned) skipped not called yet