Your concept feed

45 ideas

A few small steps. No rush.

Follow the connections in this topic

Let’s picture it

Come back to our little map.

Home
Park
Café

Home, park, café. Each place is a dot; each allowed walk is a link.

Swipe when you’re ready
One little change

A dot can also mean a situation.

Park + key
Park, no key

“At park with a key” may allow a move that “at park without a key” cannot.

Same idea. One more small step.
Now it has a name

Choose dots that tell the whole story.

situation
legal move
new situation

A graph organizes possible moves. Sometimes places are enough. Sometimes a place plus a small extra fact is needed.

Want to try a tiny question?
No pressure. Just try it.

Must graph nodes always represent physical places?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Same door. One small difference.

You + key
Locked door

You have a key. Your friend doesn’t. The door is the same, but your next move isn’t.

1 / 3
Let’s picture it

Try the nearest places first.

Home
1 road
2 roads

From home, find everything one road away before looking two roads away.

Swipe when you’re ready
One little change

Put new places at the back.

current layer
next layer

A queue keeps the earlier discoveries in front. That lets us finish one layer before the next.

Same idea. One more small step.
Now it has a name

That’s breadth-first search: BFS.

0 moves
1 move
2 moves

With equal-cost roads, the first layer reaching a place uses the fewest roads. Unequal costs need more care.

Want to try a tiny question?
No pressure. Just try it.

One road costs 100 minutes; two others cost 1 each. Fewest roads means fastest?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Come back to our little map.

Home
Park
Café

Home, park, café. Each place is a dot; each allowed walk is a link.

1 / 3
A familiar idea

Two oranges start rotten.

rotten
fresh
rotten

In this row, both ends are rotten at minute zero. The middle orange is fresh.

Swipe when you’re ready
One new wrinkle

Both ends spread together.

minute 0
minute 1
minute 0

The middle turns rotten after one minute. We should not finish one source’s entire search before starting the other.

Same idea. One more small step.
Try a tiny example

Put all starts in the queue.

all starts: 0
neighbors: 1
next: 2

Give every rotten orange distance zero. Then process the next layer just as in ordinary BFS.

Same idea. One more small step.
Notice what matters

First arrival wins.

discovered
mark once

Mark a fresh orange when it enters the queue. Two nearby sources must not count it twice.

Same idea. One more small step.
Make it reusable

One search, many beginnings.

all reached?
last arrival

The last reached fresh orange determines the time. If any fresh orange remains unreachable, return −1.

Want to try a tiny question?
No pressure. Just try it.

One fresh orange is isolated by empty cells. What happens?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Try the nearest places first.

Home
1 road
2 roads

From home, find everything one road away before looking two roads away.

1 / 3
A familiar idea

A graph without drawn roads.

cat
cot
cog
dog

Turn cat into dog. Allowed intermediate words are cot and cog. Change one letter per move.

Swipe when you’re ready
One new wrinkle

Let each word be a place.

cat
cot

Two words are neighbors when one legal letter change connects them. The dictionary decides which places exist.

Same idea. One more small step.
Try a tiny example

Every move costs one.

0 changes
1 change
2 changes

BFS visits words one change away, then two, then three. First arrival gives the fewest changes.

Same idea. One more small step.
Notice what matters

Read what the answer counts.

3 changes
4 words

cat → cot → cog → dog uses three changes, but four words. This problem asks for the number of words.

Same idea. One more small step.
Make it reusable

Generate roads only when needed.

change letter
allowed word?
enqueue

Try letter replacements and check dictionary membership. We do not need to compare every pair of words first.

Want to try a tiny question?
No pressure. Just try it.

Does choosing the word most similar to dog prove a shortest route?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Try the nearest places first.

Home
1 road
2 roads

From home, find everything one road away before looking two roads away.

1 / 3
Let’s picture it

Follow one path for a while.

Home
Park
Café

Instead of finishing a whole layer, keep walking down one branch. This is depth-first search, or DFS.

Swipe when you’re ready
One little change

Remember where you’ve been.

Home ✓
Park ✓
Café ✓

For reachability, a seen set helps avoid walking around the same cycle forever.

Same idea. One more small step.
Now it has a name

But ask what “seen” means.

this attempt
undo mark
next attempt

For routes that cannot repeat a place, a place used in one attempt may be free in another. Clear path-only marks when returning.

Want to try a tiny question?
No pressure. Just try it.

Does “used in this path” always mean “forbidden in every path”?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Open a box.

Big box
Small box
Empty

There’s a smaller box inside. We already know how to open a box.

1 / 3
Let’s picture it

Socks before shoes.

Socks
Shoes

Some jobs must wait for other jobs. Draw an arrow from the earlier job to the later one.

Swipe when you’re ready
One little change

Start with a ready job.

✓ Socks
Shoes ready

Do a job with nothing unfinished before it. Remove it from the waiting list and look for the next ready job.

Same idea. One more small step.
Now it has a name

That makes a dependency order.

A waits for B
B waits for A

Its name is topological order. A cycle means some jobs keep waiting on one another, so no such order exists.

Want to try a tiny question?
No pressure. Just try it.

A waits for B, and B waits for A. Can either start under these rules?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Come back to our little map.

Home
Park
Café

Home, park, café. Each place is a dot; each allowed walk is a link.

1 / 3
Let’s picture it

Can neighbors use different colors?

A: blue
B: pink
C: blue

Give A blue and its neighbor B pink. Then C, beside B, can be blue.

Swipe when you’re ready
One little change

Now connect C back to A.

A blue
B pink
C blue

They are both blue. Changing one forces another clash around this three-node circle.

Same idea. One more small step.
Now it has a name

Some graphs cannot use just two colors.

3-edge cycle
needs more colors

A triangle is the smallest example. More generally, an odd-length cycle prevents a two-coloring.

Want to try a tiny question?
No pressure. Just try it.

If part of the graph is disconnected, should we check it too?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Come back to our little map.

Home
Park
Café

Home, park, café. Each place is a dot; each allowed walk is a link.

1 / 3
Let’s picture it

Are these people on the same team?

Ana + Bo
Cy

Ana and Bo belong together. Cy is on a separate team.

Swipe when you’re ready
One little change

Join the teams.

Ana + Bo + Cy

A new connection joins Bo and Cy. Now all three share one group.

Same idea. One more small step.
Now it has a name

Use one name for each group.

find group
join groups

Union-find tracks group membership as connections arrive. It can tell us whether two items belong together, not the route between them.

Want to try a tiny question?
No pressure. Just try it.

Does knowing two places share a group tell us their shortest path?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Come back to our little map.

Home
Park
Café

Home, park, café. Each place is a dot; each allowed walk is a link.

1 / 3
A familiar idea

The groups need not be towns.

a, b
b, c

One account lists emails a and b. Another lists b and c. Shared b says these records belong together.

Swipe when you’re ready
One new wrinkle

Remember the first owner of each email.

email b
account 0 + 1

When b appears again, join its previous account with the current one.

Same idea. One more small step.
Try a tiny example

A third record can join indirectly.

a, b
b, c
c, d

A record containing c and d joins the same group. It never needed to share a directly.

Same idea. One more small step.
Notice what matters

Collect by final representative.

one root
a, b, c, d

After all merges, put each email into its root’s group and sort the emails for the required output.

Same idea. One more small step.
Make it reusable

Union-find fits the requested answer.

shared email ✓
same name only ×

We need identities grouped together, not a shortest chain of matching accounts. Matching names alone would not prove shared identity.

Want to try a tiny question?
No pressure. Just try it.

Two records say Ana but share no linked email. Merge them?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Are these people on the same team?

Ana + Bo
Cy

Ana and Bo belong together. Cy is on a separate team.

1 / 3
A familiar idea

Join A to B, then B to C.

A
B
C

All three towns now belong to the same group. The two roads form a tree.

Swipe when you’re ready
One new wrinkle

Now add A to C.

A
B
C

There was already a path between them. This new road closes a cycle.

Same idea. One more small step.
Try a tiny example

Ask before each union.

find(A)
find(C)
same root

If both endpoints already have the same root, the new edge is redundant for connectivity.

Same idea. One more small step.
Notice what matters

Input order gives the requested edge.

different roots: join
same root: answer

For a tree plus one extra edge, the failed union identifies the last edge of that cycle in the input.

Want to try a tiny question?
No pressure. Just try it.

Can we ignore arrows and use this to detect directed cycles?

You can also keep scrolling
1 / 5
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Are these people on the same team?

Ana + Bo
Cy

Ana and Bo belong together. Cy is on a separate team.

1 / 3
A familiar idea

Three squares already form one island.

land A
land A
land A
water

These three land squares touch. The bottom-right square is water. We may turn one water square into land.

Swipe when you’re ready
One new wrinkle

The water touches A twice.

A: size 3
flip
A: size 3

Its upper and left neighbors are different squares, but they belong to the same island.

Same idea. One more small step.
Try a tiny example

Do not count that island twice.

1 new square
1 distinct island
size 4

The new size is 1 + 3 = 4, not 1 + 3 + 3. Deduplicate the neighboring roots.

Same idea. One more small step.
Notice what matters

Group once. Test small changes.

group first
test each flip

Build every island’s root and size. For each water square, add one plus the sizes of its distinct neighboring groups.

Same idea. One more small step.
Make it reusable

A hard problem becomes local.

root
size
four neighbors

Union-find supplies group summaries. The flip only examines four neighbors. Flood-fill labels would supply the same summaries too.

Want to try a tiny question?
No pressure. Just try it.

Would scoring two flips independently always find their best combined result?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Are these people on the same team?

Ana + Bo
Cy

Ana and Bo belong together. Cy is on a separate team.

1 / 3
Let’s picture it

Roads take different times.

A→B: 5
A→C: 1
C→B: 1

A→B takes 5. A→C takes 1, and C→B takes 1.

Swipe when you’re ready
One little change

Visit the cheapest waiting place.

C: 1
B: 2

C is closest at 1. Going through it improves the time to B from 5 to 2.

Same idea. One more small step.
Now it has a name

That’s Dijkstra’s choice.

smallest distance
settle
relax neighbors

Settle the cheapest known waiting distance. Nonnegative road costs make that finalization safe; a min-heap helps pick the next one.

Want to try a tiny question?
No pressure. Just try it.

What assumption makes this ordinary finalization rule safe?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Two trees can make different promises.

8
3
10

In a search tree, smaller keys go left and larger keys go right. We’ll use distinct keys here.

1 / 3
A familiar idea

Follow the arrow for free.

→
↓
↑
finish

In this grid, moving along a cell’s arrow costs 0. Choosing a different direction costs one arrow change.

Swipe when you’re ready
One new wrinkle

A longer route can be cheaper.

3 free moves: 0
1 change: 1

Three free moves cost less than one changed arrow. Ordinary BFS’s move count is the wrong score.

Same idea. One more small step.
Try a tiny example

Keep cheap arrivals at the front.

d
d + 0
d + 1

From cost d, a free move stays at d. A changed arrow moves to d + 1.

Same idea. One more small step.
Notice what matters

A deque has two useful ends.

front: +0
back: +1

Push a zero-cost improvement to the front. Push a one-cost improvement to the back.

Same idea. One more small step.
Make it reusable

That’s 0–1 BFS.

better distance?
update
queue end

We retain cheapest-first exploration without a heap because every edge costs exactly zero or one. Revisit a cell if its cost improves.

Want to try a tiny question?
No pressure. Just try it.

If some direction changes cost 7, does this deque rule still work?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Roads take different times.

A→B: 5
A→C: 1
C→B: 1

A→B takes 5. A→C takes 1, and C→B takes 1.

1 / 3
A familiar idea

What makes a walk difficult?

4, 4 → effort 4
1, 6 → effort 6

One route has jumps 4 and 4. Another has jumps 1 and 6. Effort means the biggest single jump.

Swipe when you’re ready
One new wrinkle

Do not add the jumps.

sum: 8, effort: 4
sum: 7, effort: 6

The first route totals 8 but is gentler. The second totals 7 but contains the larger jump.

Same idea. One more small step.
Try a tiny example

Keep the worst jump so far.

max(4, 2) = 4
max(4, 7) = 7

Extending effort 4 with a jump of 2 keeps effort 4. A jump of 7 raises it to 7.

Same idea. One more small step.
Notice what matters

The score cannot fall as we walk.

heap minimum
max on extension

That lets Dijkstra settle the smallest waiting effort. Relax with max(old effort, new jump) instead of addition.

Same idea. One more small step.
Make it reusable

Same structure. Different path score.

cell
neighbor
height difference

A grid cell is still a node. Four neighboring cells supply edges weighted by their height differences.

Want to try a tiny question?
No pressure. Just try it.

Which score should the heap prioritize here?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Roads take different times.

A→B: 5
A→C: 1
C→B: 1

A→B takes 5. A→C takes 1, and C→B takes 1.

1 / 3
Let’s picture it

A road gives a refund.

A→B: 2
A→C: 5
C→B: −4

A→B costs 2. A→C costs 5. C→B refunds 4, so that edge costs −4.

Swipe when you’re ready
One little change

A later route becomes cheaper.

5 − 4
B costs 1

Through C, B costs only 1. Calling B final at 2 would have been too early.

Same idea. One more small step.
Now it has a name

Recheck improvements instead.

check edges
improve
check again

Bellman–Ford repeatedly checks edges. A reachable negative cycle means some distances can keep decreasing instead of having a finite minimum.

Want to try a tiny question?
No pressure. Just try it.

Does a negative edge alone always mean a negative cycle?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Roads take different times.

A→B: 5
A→C: 1
C→B: 1

A→B takes 5. A→C takes 1, and C→B takes 1.

1 / 3
A familiar idea

Now every city asks about every other.

A→B: 8
A→C: 2
C→B: 3

A→B costs 8. A→C costs 2, and C→B costs 3. We want distances between all pairs.

Swipe when you’re ready
One new wrinkle

Allow one new intermediate city.

via C
2 + 3
5 beats 8

If C is allowed between A and B, their best cost improves to 2 + 3 = 5.

Same idea. One more small step.
Try a tiny example

Give the table a precise meaning.

from i
to j
allowed through k

After processing city k, each entry is best among routes using only the intermediate cities allowed so far.

Same idea. One more small step.
Notice what matters

Try that one bridge for every pair.

direct best
via k best

Compare d[i][j] with d[i][k] + d[k][j]. Keep k as the outer loop so every pair gets the same new permission.

Same idea. One more small step.
Make it reusable

Floyd–Warshall is graph DP.

all distances
count nearby
break ties

For the city problem, count distances within the threshold. Among tied smallest counts, choose the larger city number.

Want to try a tiny question?
No pressure. Just try it.

Should this cubic-time method be your default for a huge sparse graph?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

A road gives a refund.

A→B: 2
A→C: 5
C→B: −4

A→B costs 2. A→C costs 5. C→B refunds 4, so that edge costs −4.

1 / 3
Let’s picture it

Connect three towns with cable.

AB: 1
BC: 2
AC: 5

AB costs 1, BC costs 2, and AC costs 5. We want everyone connected cheaply.

Swipe when you’re ready
One little change

Two cables are enough.

AB: 1 ✓
BC: 2 ✓
AC: 5 ×

Take AB and BC. All towns connect for 3. Adding AC would make an unnecessary cycle.

Same idea. One more small step.
Now it has a name

That’s a minimum spanning tree.

total cable cost
not every route

Minimize the total connection cost. This differs from minimizing each travel distance from a starting town.

Want to try a tiny question?
No pressure. Just try it.

If the original graph is disconnected, can cables from its edges connect every town?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Are these people on the same team?

Ana + Bo
Cy

Ana and Bo belong together. Cy is on a separate team.

1 / 3
A familiar idea

Grow one connected piece of the network.

AB: 1
AC: 4
BC: 2

AB costs 1, AC costs 4, and BC costs 2. Start with only A inside.

Swipe when you’re ready
One new wrinkle

Take the cheapest edge leaving the piece.

inside: A,B
outside: C

AB adds B for 1. The connected piece is now {A, B}.

Same idea. One more small step.
Try a tiny example

Refresh the crossing choices.

AC: 4
BC: 2 ✓

C can join through AC for 4 or BC for 2. Choose BC; the network costs 3.

Same idea. One more small step.
Notice what matters

The heap key is an edge cost.

Prim: next edge
Dijkstra: whole route

Prim grows one tree through cheapest crossing edges. Dijkstra instead prioritizes total route costs from a source.

Same idea. One more small step.
Make it reusable

Kruskal reaches the same objective differently.

one growing tree
many merging trees

Kruskal sorts all edges and merges many groups. Prim grows one group. Both minimize total connecting cost, not every travel distance.

Want to try a tiny question?
No pressure. Just try it.

Can Prim’s selected routes replace Dijkstra’s shortest routes?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Connect three towns with cable.

AB: 1
BC: 2
AC: 5

AB costs 1, BC costs 2, and AC costs 5. We want everyone connected cheaply.

1 / 3
A familiar idea

Let water open the grid gradually.

0 start
3
1
2 finish

Heights are 0, 3 on top and 1, 2 below. A square is usable once water reaches its height.

Swipe when you’re ready
One new wrinkle

At level 1, only two squares open.

0 open
3 closed
1 open
2 closed

Start and bottom-left connect. The finish at height 2 is still closed.

Same idea. One more small step.
Try a tiny example

At level 2, the finish joins.

0
1
2

The route 0 → 1 → 2 becomes possible. No need to wait for the height-3 square.

Same idea. One more small step.
Notice what matters

Activate, then merge neighbors.

next height
activate
union

Sort squares by height. Each new square joins its already-open neighbors through union-find.

Same idea. One more small step.
Make it reusable

Stop when the corners share a group.

level rises
groups merge
corners meet

This is the same bottleneck idea as minimum effort, viewed as increasing a threshold until a route exists.

Want to try a tiny question?
No pressure. Just try it.

Must every square be open before we can finish?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Three squares already form one island.

land A
land A
land A
water

These three land squares touch. The bottom-right square is water. We may turn one water square into land.

1 / 5
A familiar idea

Which road has no backup?

triangle A–B–C
B–D only

A, B, C form a triangle. D connects only to B. Removing B–D separates D.

Swipe when you’re ready
One new wrinkle

DFS gives each arrival a time.

A: 0
B: 1
C: 2

Explore A, then B, then C. C can reach earlier A without retracing its parent edge.

Same idea. One more small step.
Try a tiny example

Send the earliest reachable time upward.

C reaches 0
B receives 0

C reports 0 back to B. The triangle’s branch has another way back, so B–C is not a bridge.

Same idea. One more small step.
Notice what matters

D cannot report an escape.

low[D] > time[B]
bridge

If low[D] is greater than B’s arrival time, D’s branch cannot get back without B–D. That edge is a bridge.

Same idea. One more small step.
Make it reusable

One DFS, one summary per branch.

arrival time
lowest escape
parent edge

This low-link summary avoids removing every edge and rerunning reachability. Track edge IDs so parallel roads are handled correctly.

Want to try a tiny question?
No pressure. Just try it.

Two parallel roads connect A and B. Is either one a bridge?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Follow one path for a while.

Home
Park
Café

Instead of finishing a whole layer, keep walking down one branch. This is depth-first search, or DFS.

1 / 3
A familiar idea

Arrows change what a group means.

A ↔ B
C

A reaches B, and B reaches A. B also reaches C, but C cannot return.

Swipe when you’re ready
One new wrinkle

Only mutual reachability makes a group.

{A, B}
{C}

A and B share one strongly connected component. C belongs to another.

Same idea. One more small step.
Try a tiny example

First remember finishing order.

explore children
then record node

Run DFS and write each node after its outgoing exploration finishes. These finishing times identify which regions to handle first.

Same idea. One more small step.
Notice what matters

Reverse arrows. Follow reverse finish order.

reverse edges
latest finish first
collect group

A second DFS on reversed edges collects one component at a time. The finishing order prevents drifting into an unprocessed neighboring component.

Same idea. One more small step.
Make it reusable

Shrink each group into one dot.

group 1
group 2
group 3

The remaining graph is acyclic: a cycle between groups would mean they should have been one mutual-reachability group.

Want to try a tiny question?
No pressure. Just try it.

Does ordinary union-find preserve which directed nodes can return to each other?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Follow one path for a while.

Home
Park
Café

Instead of finishing a whole layer, keep walking down one branch. This is depth-first search, or DFS.

1 / 3
A familiar idea

One exit does not make a place safe.

A
exit
loop

A can go to an exit or enter a loop. The question asks whether every possible walk eventually stops.

Swipe when you’re ready
One new wrinkle

Start with places that must stop.

no outgoing roads
safe

A terminal node has no outgoing choices. It is safe immediately.

Same idea. One more small step.
Try a tiny example

Work backward from safe places.

all choices safe
node safe

Once every outgoing neighbor of a node is safe, that node is safe too. One safe neighbor is not enough.

Same idea. One more small step.
Notice what matters

Reverse the edges to notify predecessors.

safe child
notify parents
count reaches 0

Remove each proven-safe outgoing choice. A remaining-outdegree count of zero makes the predecessor ready.

Same idea. One more small step.
Make it reusable

Cycles never become ready.

cycle
never fully removed

Nodes on a cycle, or able to reach one, retain an unsafe choice. This is topological elimination from the other end.

Want to try a tiny question?
No pressure. Just try it.

A has one road to an exit and one to a cycle. Is A safe?

You can also keep scrolling
1 / 6
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Socks before shoes.

Socks
Shoes

Some jobs must wait for other jobs. Draw an arrow from the earlier job to the later one.

1 / 3
Let’s picture it

Neighbors must sit on opposite sides.

A left
B right
C left

For A—B—C, place A left, B right, and C left.

Swipe when you’re ready
One little change

A cycle can create a contradiction.

A:0
B:1
C:?

In triangle A—B—C—A, alternating colors makes C both opposite B and opposite A.

Same idea. One more small step.
Now it has a name

Color every component.

new component
color 0
alternate

Start an uncolored node with either color, then BFS or DFS while enforcing opposite colors on every edge.

Want to try a tiny question?
No pressure. Just try it.

Which cycle length makes two-coloring impossible?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Can neighbors use different colors?

A: blue
B: pink
C: blue

Give A blue and its neighbor B pink. Then C, beside B, can be blue.

1 / 3
Let’s picture it

The task is about edges, not vertices.

A→B
B→A
A→C

A→B, B→A, A→C can be walked using every directed edge exactly once: A,B,A,C.

Swipe when you’re ready
One little change

Following an edge may create a dead end.

take unused edge
walk until stuck

Do not finalize a vertex when first seen. Keep walking unused edges until stuck.

Same idea. One more small step.
Now it has a name

Build the answer backward.

dead end → append
reverse finishes

When a vertex has no unused outgoing edge, append it. Reversing these finish points gives the trail.

Want to try a tiny question?
No pressure. Just try it.

Why is an ordinary visited-vertex set wrong here?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Follow one path for a while.

Home
Park
Café

Instead of finishing a whole layer, keep walking down one branch. This is depth-first search, or DFS.

1 / 3
Let’s picture it

Edges have capacities.

source→A:3
A→sink:2

Source can send 3 units to A, and A can send only 2 to sink. This route carries at most 2.

Swipe when you’re ready
One little change

Used capacity leaves a reverse option.

forward remaining
reverse undo

Sending one unit creates residual ability to undo that unit. A later path can reroute an earlier choice.

Same idea. One more small step.
Now it has a name

Find augmenting level paths.

BFS levels
send flow
repeat

BFS builds distance levels in the residual graph. DFS sends flow only forward through those levels until blocked.

Want to try a tiny question?
No pressure. Just try it.

Why does the residual graph contain reverse edges?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Roads take different times.

A→B: 5
A→C: 1
C→B: 1

A→B takes 5. A→C takes 1, and C→B takes 1.

1 / 3
Let’s picture it

Each left item wants one right item.

A,B
X,Y
one each

Workers A,B can do jobs X,Y. Each worker and job may appear in at most one chosen pair.

Swipe when you’re ready
One little change

A direct choice may block another worker.

B→X
X←A→Y

If A takes X, B may have nowhere. An augmenting path can move A to Y and give X to B.

Same idea. One more small step.
Now it has a name

Search for one more assignment.

unmatched edge
matched edge back
free job

From each unmatched left vertex, follow unused edges and matched edges alternately to reach a free right vertex.

Want to try a tiny question?
No pressure. Just try it.

Why may an existing match need to move?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Neighbors must sit on opposite sides.

A left
B right
C left

For A—B—C, place A left, B right, and C left.

1 / 3
Let’s picture it

The target can guide exploration.

current
estimated remainder
goal

On a grid, Manhattan distance estimates remaining moves without crossing walls.

Swipe when you’re ready
One little change

Order by spent plus estimated.

g spent
h estimate
f total guess

Dijkstra orders by g, the cost already paid. A* orders by f=g+h to prefer states promising a smaller total.

Same idea. One more small step.
Now it has a name

The estimate needs a promise.

admissible h
optimal goal

If h never overestimates the true remaining cost, popping the goal under the usual conditions gives an optimal route.

Want to try a tiny question?
No pressure. Just try it.

What happens when h is always zero?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Roads take different times.

A→B: 5
A→C: 1
C→B: 1

A→B takes 5. A→C takes 1, and C→B takes 1.

1 / 3
Let’s picture it

Removing one vertex removes all its edges.

A
B removed
C,D

In A—B—C with B—D, removing B separates A, C, and D.

Swipe when you’re ready
One little change

Child summaries reveal backup routes.

child v
low[v]
ancestor

For DFS child v, low[v] tells the earliest ancestor its subtree can reach without using the parent edge.

Same idea. One more small step.
Now it has a name

Roots need a separate rule.

non-root ≥
root children >1

A non-root u is fragile when some child has low[v] ≥ disc[u]. A root is fragile only with multiple DFS children.

Want to try a tiny question?
No pressure. Just try it.

Why does the bridge test use > while a non-root articulation test uses ≥?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Which road has no backup?

triangle A–B–C
B–D only

A, B, C form a triangle. D connects only to B. Removing B–D separates D.

1 / 5
Let’s picture it

Deletions are hard for ordinary union-find.

union easy
delete hard

Roads disappear over time. Union-find can join groups quickly but cannot split a stored tree when one road vanishes.

Swipe when you’re ready
One little change

If all questions are known, reverse them.

final graph
reverse
add roads back

The final graph contains roads never deleted. Moving backward turns each deletion into an addition.

Same idea. One more small step.
Now it has a name

Answer before undoing each deletion.

query roots
reverse delete → union

Process operations backward. Connectivity queries use current roots; a forward delete becomes a reverse union.

Want to try a tiny question?
No pressure. Just try it.

What property makes reverse-time processing possible?

You can also keep scrolling
1 / 4
Graphs

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Are these people on the same team?

Ana + Bo
Cy

Ana and Bo belong together. Cy is on a separate team.

1 / 3
You've reached the end of these ideas.Try them without the labels