Your concept feed

33 ideas

A few small steps. No rush.

Follow the connections in this topic

Let’s picture it

Walk across four squares.

Start
·
·
Finish

Start at the top-left. Reach the bottom-right. For now, moves only go right or down.

Swipe when you’re ready
One little change

Two tiny routes.

Right → Down
Down → Right

Right, then down. Or down, then right. Both reach the same finish.

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

A square can share its answer.

row
column

Row and column name the remaining journey. With only right/down moves, we can fill answers without moving in circles.

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

If moves can go in circles, is this simple fill order automatically safe?

You can also keep scrolling
1 / 4
2D dynamic programming

One small step at a time.

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

Two ways to fill a notebook.

asked?
solve once
save

One way: when a question appears, solve it if needed, then write down the answer.

1 / 3
Let’s picture it

Keep letters in the same order.

abc
ac

Compare abc with ac. We can keep a, skip b, then keep c. The shared sequence is ac.

Swipe when you’re ready
One little change

Put a bookmark in each word.

b → c
c

After keeping a, we compare b with c. Skipping b moves only the first bookmark. Now c matches c.

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

Two bookmarks name one question.

position in word 1
position in word 2

Ask for the longest shared sequence remaining. Equal letters can join it; otherwise, try skipping from either string and keep the better answer.

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

May we rearrange letters to make the shared sequence longer?

You can also keep scrolling
1 / 4
2D dynamic programming

One small step at a time.

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

Keep some numbers in order.

3 ×
1 ✓
2 ✓

From 3, 1, 2, we can keep 1 then 2. We are allowed to skip 3.

1 / 3
A familiar idea

Keep the two bookmarks. Change the question.

cat
cut

Turn cat into cut. We are allowed to insert, delete, or replace one character at a time.

Swipe when you’re ready
One new wrinkle

Matching c costs nothing.

at
ut

Move both bookmarks past c. Now compare a with u.

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

A mismatch offers three choices.

delete: i+1
insert: j+1
replace: both

Delete a: move only in the source. Insert u: move only in the target. Replace a with u: move in both.

Same idea. One more small step.
Notice what matters

Try each edit, then solve the smaller conversion.

1 + delete rest
1 + insert rest
1 + replace rest

Each edit costs one. Take one plus the smallest remaining cost. Matching characters simply advance both positions.

Same idea. One more small step.
Make it reusable

An empty suffix gives the stopping answer.

cat
replace a
cut

If one side is empty, insert or delete every remaining character on the other. For cat → cut, one replacement is enough.

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

Would counting only insertions and deletions give cat → cut a cost of one?

You can also keep scrolling
1 / 6
2D dynamic programming

One small step at a time.

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

Keep letters in the same order.

abc
ac

Compare abc with ac. We can keep a, skip b, then keep c. The shared sequence is ac.

1 / 3
Let’s picture it

Will this snack fit?

snack: 3
room: 4 ✓
room: 2 ×

The snack weighs 3. A bag with 4 spaces can take it; a bag with 2 cannot.

Swipe when you’re ready
One little change

Remember the room left.

next item
room left

Seeing the same next item doesn’t mean having the same choices. The remaining capacity matters too.

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

Give the question two labels.

item position
capacity

For 0/1 knapsack, remember which item comes next and how much capacity remains. Each item can be chosen at most once.

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

For 0/1 knapsack, after taking an item, can we take that same item again?

You can also keep scrolling
1 / 4
2D dynamic programming

One small step at a time.

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

We’ve answered this before.

route A
3 stairs left
route B

Two routes leave us with three stairs left. We may climb one or two at a time.

1 / 3
Let’s picture it

Which cut should be last?

left part
split
right part

Some problems concern one stretch of items. Try choosing the final split, instead of the first action.

Swipe when you’re ready
One little change

Solve the two sides.

best left
cost
best right

If that split makes the sides independent, combine their best answers and the split’s cost.

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

Name a stretch by its ends.

left boundary
right boundary

Interval DP uses a left and right boundary. Try possible split points. First check that the two sides really are independent.

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

Can we combine two independently solved sides if hidden choices still link them?

You can also keep scrolling
1 / 4
2D dynamic programming

One small step at a time.

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

We’ve answered this before.

route A
3 stairs left
route B

Two routes leave us with three stairs left. We may climb one or two at a time.

1 / 3
A familiar idea

Popping changes the neighbors.

1 boundary
2
3
1 boundary

Balloons are 2 and 3, with pretend 1s outside. A pop earns left × balloon × right.

Swipe when you’re ready
One new wrinkle

Choosing first tangles the two sides.

left
pop
right

A popped balloon disappears, so previously separated neighbors meet. Their future rewards now interact.

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

Try choosing the last balloon instead.

pop 2: 6
pop 3: 3
total: 9

If 3 is last, pop 2 first for 1×2×3 = 6. Then pop 3 for 1×3×1 = 3. Total: 9.

Same idea. One more small step.
Notice what matters

Fixed boundaries make the sides independent.

left interval
k last
right interval

For a larger interval, keep its outer balloons alive. Try k as the last inside balloon; solve the two sides before popping k.

Same idea. One more small step.
Make it reusable

Interval DP earns its split.

left best
right best
last reward

best(l,r) tries each last k: best(l,k) + best(k,r) + value[l]×value[k]×value[r]. Adjacent boundaries contain nothing, so return zero.

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

What becomes known when we choose the last balloon inside an interval?

You can also keep scrolling
1 / 6
2D dynamic programming

One small step at a time.

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

Which cut should be last?

left part
split
right part

Some problems concern one stretch of items. Try choosing the final split, instead of the first action.

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