Watch every algorithm
unfold in real time.

Pick a problem, hit play, and actually see what the code is doing — on real trees, arrays, and graphs. 150+ problems from the most common interview patterns, broken down step by step so nothing feels like magic.

See how algorithms actually move

No more staring at code hoping it clicks. Watch every node visit, every comparison, every pointer shift play out on real data structures — right in front of you.

3 9 20 15 7

Follow the code, line by line

Each step highlights the exact line running. You see the code, you see what it does to the data structure — and suddenly the solution makes sense.

1def maxDepth(root):
2 if not root: return 0
3 left = maxDepth(root.left)
4 right = maxDepth(root.right)
5 return max(left, right) + 1

Watch the call stack push & pop

Recursion finally makes sense when you can see it. The stack grows as calls go deeper, then unwinds as values come back up. No more hand-tracing on paper.

CALL STACK
maxDepth(15) depth 3
maxDepth(20) depth 2
maxDepth(3) depth 1

Whiteboard & notes, built in

Drop in trees, linked lists, arrays — or just sketch your approach freehand. Drag nodes around, edit values, jot notes next to your diagrams. Everything saves on its own.

📄 Remove Linked List Elements
✓ Saved
null 1 2 6 3 remove this node → head

Relink node 2 → node 3, then return head

How to get the most out of it

The study loop that actually makes algorithms stick.

1. Try the problem first

Give it a real shot — 20 to 30 minutes. Even if you don't crack it, the struggle is what makes the solution stick later.

2. Walk through it on AlgoFlowz

Search for the problem, pick an algorithm, and step through it frame by frame. See every operation happen on the actual data.

3. Go back and write it yourself

Now that you've seen how it works, implement the solution from understanding — not memorization. That's where the real learning happens.

4. Start seeing the patterns

After a handful of problems, the same patterns keep showing up. Once you spot them, new problems stop feeling impossible.

Stop re-reading solutions
that don't click.

150+ problems. Every major pattern. One step at a time.

Menu
Log in or sign up

Welcome to AlgoFlowz

or

Choose a Problem

Select an algorithm to visualize step-by-step

SOURCE CODE
Python
Time Complexity O(n)
Space Complexity O(h)
Algo
CALL STACK
Active 0
Depth 0
Max 0
My Notes

Recommended Videos

The 3-Reverse Trick

When you rotate an array right by k, you're taking the last k elements and moving them to the front, while shifting everything else back.

Instead of moving them one by one, we use reversal to flip the chunks into place.

Walkthrough [1, 2, 3, 4, 5]  →  rotate by k = 2  →  [4, 5, 1, 2, 3]
1
Reverse the entire array [1, 2, 3, 4, 5] → [5, 4, 3, 2, 1]

This moves the elements that belong at the front (4, 5) to the front, and the elements that belong at the back (1, 2, 3) to the back. But both chunks are currently backwards.

2
Reverse the first k elements [0..1] [5, 4, 3, 2, 1] → [4, 5, 3, 2, 1]

The front chunk (5, 4) gets flipped back to its correct order (4, 5).

3
Reverse the remaining elements [2..4] [4, 5, 3, 2, 1] → [4, 5, 1, 2, 3]

The back chunk (3, 2, 1) gets flipped back to its correct order (1, 2, 3). Done.

Why it works: Reversing the whole array puts each chunk in the right half, just in the wrong internal order. The two sub-reverses fix each chunk without moving them out of place.
Time: O(n) Space: O(1) Each element is visited at most twice.

How the Greedy Approach Works

Think of it like exploring a map. You start with a small area you can reach. You look around, figure out the farthest spot you can get to next, then "jump" — expanding your reach.

Each jump opens up a new zone. You keep going until the end is inside your zone.

The Core Idea Each jump opens the widest possible next zone — so you never waste a jump
1
Two loops, two jobs

The outer loop handles jumps — each time it runs, you're making one jump.

The inner loop looks at every cell in your current zone and asks: "what's the farthest any of these can reach?"

2
What L and R mean

L and R mark the edges of your current zone — everything between them is reachable with the current number of jumps.

Think of it like: "I can land on any of these spots right now."

3
Finding the farthest reach

Each cell in the zone is a launch pad. We check every one and remember whichever can reach the farthest: farthest = max(farthest, i + nums[i])

We don't care which cell was best — just how far the best one gets us. That becomes the right edge of our next zone.

4
Making the jump

After checking every cell in [L, R]:

L = R + 1   (new zone starts)
R = farthest  (new zone ends)
jumps += 1

The old zone fades out. The new, bigger zone lights up.

5
Why this gives the fewest jumps

By always expanding to the farthest reachable point, you cover the most ground per jump. There's no scenario where a shorter jump now would save you jumps later.

Think of it this way: Each zone is "everywhere I can be in exactly N jumps." The inner loop finds the frontier of the next zone. When you step forward, you unlock a bigger region. Expanding as far as possible each time guarantees the fewest total jumps.
Time: O(n) — each index visited once Space: O(1) — just L, R, farthest, jumps

Report a Bug or Send Feedback