Your concept feed

16 ideas

A few small steps. No rush.

Follow the connections in this topic

Let’s picture it

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.

Swipe when you’re ready
One little change

Remember the key.

at door
has key?

If we only write down “at the door,” we lose something important.

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

That little note is a state.

place
key: yes

A state remembers what we need to continue. Here: where we are, and whether we have the key.

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

Is “at the door” enough to decide if we can enter?

You can also keep scrolling
1 / 4
The foundations

One small step at a time.

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

What if it rains?

☔ Rain
☕ Café

Let’s choose the café on rainy days, and the park on sunny days.

1 / 3
Let’s picture it

How many little jobs?

Hi
Hi
Hi

Visit three places. Say hello once at each. That’s three hellos.

Swipe when you’re ready
One little change

Now try every pair.

3 people
× 3 greetings
= 9

Three people each greet all three people, including themselves for this toy count. That’s nine greetings.

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

Count how the work grows.

one pass: n
all pairs: n²

One pass grows with n. Trying every pair grows with n × n. Code length doesn’t tell us that.

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

With 4 items, how many ordered pairs, including self-pairs?

You can also keep scrolling
1 / 4
The foundations

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

Find 8 in a sorted row.

2
4
6
8
10

Start with 2, 4, 6, 8, 10. Look at the middle: 6.

Swipe when you’re ready
One little change

Keep the side that can work.

2 ×
4 ×
6 ×
8
10

8 is bigger than 6. Everything on the left is too small, so we can leave it behind.

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

Keep one promise.

8
10

If 8 is present, it stays in the part we keep. That repeating promise is called an invariant.

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

Would this left-or-right shortcut work on an unsorted row?

You can also keep scrolling
1 / 4
The foundations

One small step at a time.

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

How many little jobs?

Hi
Hi
Hi

Visit three places. Say hello once at each. That’s three hellos.

1 / 3
A familiar idea

Split a row into two groups.

3
2
4

Values are 3, 2, 4. Keep their order. We want the smallest possible largest group sum.

Swipe when you’re ready
One new wrinkle

Try a cap of 4.

[3]
[2]
[4]

3 and 2 cannot stay together. Neither can 2 and 4. We need three groups, so cap 4 is too small.

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

Try a cap of 5.

[3, 2] = 5
[4] = 4

[3, 2] and [4] fit. A cap of 6 would work too. Making the cap larger cannot hurt.

Same idea. One more small step.
Notice what matters

The answers have a boundary.

4: no
5: yes
6: yes

Too small, too small, then possible forever. Binary search can find that first possible cap.

Same idea. One more small step.
Make it reusable

Search answers, not positions.

guess cap
count groups
keep half

Test a cap by greedily filling each group before starting the next. Nonnegative values make this feasibility test safe.

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

Which guarantee makes the greedy group test safe?

You can also keep scrolling
1 / 6
The foundations

One small step at a time.

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

Find 8 in a sorted row.

2
4
6
8
10

Start with 2, 4, 6, 8, 10. Look at the middle: 6.

1 / 3
Let’s picture it

Keep a small part of a row.

2
3

Our budget is 5. The values 2 and 3 fit together.

Swipe when you’re ready
One little change

One more makes it too much.

2 + 3 + 4 = 9
4 fits

Add 4: the sum is 9. Remove from the left until it fits again.

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

That moving part is a window.

left edge
kept values
right edge

With nonnegative values, adding cannot lower the sum. That predictable change tells us which boundary to move.

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

Could adding a negative number make a too-large sum fit?

You can also keep scrolling
1 / 4
The foundations

One small step at a time.

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

Find 8 in a sorted row.

2
4
6
8
10

Start with 2, 4, 6, 8, 10. Look at the middle: 6.

1 / 3
A familiar idea

A window meets a negative number.

2
−1
1

Find stretches totaling 2 in [2, −1, 1]. Adding −1 shrinks the sum, so the usual window direction is no longer reliable.

Swipe when you’re ready
One new wrinkle

Keep a running total instead.

0
2
1
2

Before anything: 0. After each number: 2, 1, 2. These totals describe the boundaries between items.

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

Subtract two boundaries.

earlier: 0
current: 2
difference: 2

A current total of 2 minus an earlier total of 0 gives a stretch totaling 2.

Same idea. One more small step.
Notice what matters

Ask for the missing earlier total.

s − k
how many earlier?

At total s, look for earlier total s − k. Count how often it appeared, then record s.

Same idea. One more small step.
Make it reusable

Prefix sums meet a dictionary.

[2]
[2, −1, 1]

The two valid stretches are [2] and [2, −1, 1]. We found both without trying every starting point again.

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

Why count earlier totals instead of keeping only a set?

You can also keep scrolling
1 / 6
The foundations

One small step at a time.

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

Keep a small part of a row.

2
3

Our budget is 5. The values 2 and 3 fit together.

1 / 3
A familiar idea

Who is still waiting for warmth?

73
71
74

Temperatures are 73, 71, 74. The first two days have not yet seen a warmer day.

Swipe when you’re ready
One new wrinkle

74 answers two questions.

73: wait 2
71: wait 1
74: waiting

It is warmer than 71, and also warmer than 73. Their waits end together.

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

Keep only unanswered days.

71 · top
73 · bottom

Store their positions in a stack. Temperatures go downward from the bottom toward the top.

Same idea. One more small step.
Notice what matters

Resolve the top while you can.

waiting index
today’s index
subtract

When a warmer day arrives, pop each cooler waiting day and record the distance between their positions.

Same idea. One more small step.
Make it reusable

That’s a monotonic stack.

push once
pop once

Each day enters once and leaves at most once. The nested while loop still does only linear total popping.

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

Does a day at 73 resolve an earlier day at 73?

You can also keep scrolling
1 / 6
The foundations

One small step at a time.

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

Picture a pile of plates.

Pink · top
Blue · bottom

Blue goes down first. Pink goes on top.

1 / 3
A familiar idea

Reuse the waiting stack.

2
4
2

Now the bars have heights 2, 4, 2. We want the biggest rectangle under neighboring bars.

Swipe when you’re ready
One new wrinkle

The tallest bar is not enough.

4 × 1 = 4
2 × 3 = 6

Height 4 across one bar gives area 4. Height 2 across all three gives area 6.

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

Wait until a shorter bar arrives.

2
4 stops
2

The final 2 stops the height-4 rectangle. We now know its right boundary.

Same idea. One more small step.
Notice what matters

The stack remembers the other boundary.

left: 0
width: 1
right: 2

Pop 4. The previous smaller bar is at position 0; the new smaller bar is at 2. Width: 2 − 0 − 1.

Same idea. One more small step.
Make it reusable

Close every waiting rectangle.

height × width
keep maximum

Use a zero-height sentinel at the end. Popping bars computes completed areas; keep the biggest.

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

Why does a shorter bar matter?

You can also keep scrolling
1 / 6
The foundations

One small step at a time.

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

Who is still waiting for warmth?

73
71
74

Temperatures are 73, 71, 74. The first two days have not yet seen a warmer day.

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