Intermediate 1
Hello! This is page 8 of the course called “Y Combinator for Non-programmers”. If you just got here, click here to read from the beginning.

Y Combinator for
Non-programmers

Intermediate 2: The Challenge Question

Slide 1 / 8

Things will get harder

Warning: From this page, things will get much harder. The lunchboxes will become more complicated.

Things will get harder

But: You don’t need to understand everything immediately. Even if you don’t completely get it, please keep reading!

Looking for some other page?

Intermediate 1·
·Intermediate 3
Slide 2 / 8

The problem

As promised: If you can solve this problem, I’ll return your mathboxes.

Minion, explain the problem!

Sure. First, take a look at this lunchbox.

We learned on the last page that I can convert this lunchbox to .

’s with on the bottom-right
→ Can be converted to

Now, take a look at this lunchbox.

Each icon represents a food item.

Each icon represents a food item
13
2
23
1

We now combine the above two lunchboxes.

If you combine them, it’ll look like this:

After combining the two lunchboxes
1
1
13
2
23
1

Now, here’s the challenge:

  • Fill each icon in a way such that,
  • After you run it,
  • The resulting lunchbox can be converted to .
Challenge:
Fill each icon in such a way that,
1
1
13
2
23
1
After you run it,
the resulting lunchbox can be converted to .
Lunchbox that can be converted to

This is the “very difficult question” I’ve been talking about.

If you solve this, I’ll return your mathboxes!

Slide 3 / 8

Try filling with random items

Hmm… I don’t know if I understood the problem.

And I have no idea how to solve it!

No problem! First, try filling each icon with a random food item.

By doing so, you’ll be able to understand the problem better.

Try filling each icon
with a random food item!
1
1
13
2
23
1

Ok, let me try…

Here it is: I randomly filled each icon with sushi , a sandwich , or a hamburger .

Randomly filled each icon with
1
1
13
2
23
1

Now, we’ll run the above lunchbox, and…

  • If it becomes a lunchbox that can be converted to , it’s a success!
  • If not, then it’s a failure.
We’ll run this lunchbox, and…
1
1
13
2
23
1
If it becomes a lunchbox that can be
converted to , success.
Otherwise, failure

Ok, let’s run it!

Need a review? To solve the above lunchbox, we’ll need to use the rules from Beginner 5.

If you want to review them, press “Do a Quick Review” below.

Slide 4 / 8

Let’s run it!

Let’s run it!

First: Because there are multiple pairs of 1’s, we start from the leftmost pair.

Press Run . (Or press to step through manually.)

If there are multiple pairs of 1’s,
start with the leftmost pair.
1
1
13
2
23
1

Second: We can’t start with the leftmost pair of 1’s because there’s only one item on the bottom (a sandwich ).

Therefore, we do the pair of 2’s.

Press Run :

If you can’t start with 1’s because
there’s only one item on the bottom row,
start with the pair of 2’s.
13
2
23
1

Third: We’ll need to start with the pair of 2’s again, just like the last time.

Press Run :

If you can’t start with 1’s because
there’s only one item on the bottom row,
start with the pair of 2’s.
12
2
1

So this is the final result!

Final result
1
1
Slide 5 / 8

Can’t convert to a mathbox

Now, we want to convert this to a mathbox…

But unfortunately: I won’t be able to convert this.

Can’t convert this to a mathbox
1
1

Why not? Because it doesn’t follow this pattern:

There needs to be one
on the top-right and some number of
’s on the bottom-right
One
Some’s

There needs to be exactly one on the top-right, but that’s not the case here.

What’s on the top-right is not .
Instead, it’s . That’s why it cannot be
converted to a mathbox.
1
1

Hmm… if the top-right was a hamburger instead of a sandwich , it could have been converted to .

It was so close!

If the top-right was a hamburger ,
it could have been converted to
1
1
Slide 6 / 8

Failure

So: Because it didn’t become a lunchbox that can be converted to at the end…

When you run it…
1
1
13
2
23
1
It didn’t become a lunchbox
that can be converted to
1
1

Your answer was incorrect.

Filling each icon…
13
2
23
1
In the following way was incorrect
13
2
23
1

Hmm… sad!

Slide 7 / 8

Let’s try again

Hopefully you understood what the problem is asking. So let’s state it again:

  • Fill each icon in a way such that,
  • After you run it,
  • The resulting lunchbox can be converted to .
Challenge:
Fill each icon in such a way that,
1
1
13
2
23
1
After you run it,
the resulting lunchbox can be converted to .
Lunchbox that can be converted to

Again: The “random” lunchbox you came up with was incorrect.

Try to see if you can come up with a different one that works!

This was incorrect
13
2
23
1

Hmm… I now understand the problem, but I don’t know how to solve it!

Slide 8 / 8

Can the villagers solve this problem?

The villagers are so close to getting their mathboxes back, but they’re struggling. Let’s see if they can solve it on the next page!

Go to Next PageContinue to Intermediate 3
3 more intermediate levels left!
Intermediate 1
Japanese Site (日本語版) · About this Site · Twemoji