It is a miniature reconstruction: each figure seems local, but ends up fixing the entire row. The pleasure is in watching a dry sequence become almost inevitable.

The height shelf

Reasoner
Master plays

Riddle statement

Five books of different heights 1, 2, 3, 4 and 5—where 1 is the shortest and 5 the tallest—are placed in a row.

Each book writes down how many books taller than it has to its left.

The notes, from left to right, are:
\[
0,\ 1,\ 1,\ 3,\ 2.
\]

In what order are the books, from left to right?

Show solution

Solution

Answer: $ 5,\ 2,\ 4,\ 1,\ 3. $

Let's call the heights from left to right $a_1,\dots,a_5$.

  • The fourth note is $3$. To the left of the fourth book there are exactly three positions, so all three must be higher than him. Therefore, $ a_4=1. $

  • The fifth note is $2$. Among the four books to his left there must be exactly two taller than him. We already know that $a_4=1$, so the fifth book must exceed $1$ but fall below exactly two of the three remaining $\{2,4,5\}$ values. The only value that satisfies this is $3$, since $2$ would be below three and $4$ or $5$ would be below less than two. Therefore, $ a_5=3. $

The heights $\{2,4,5\}$ remain for the first three positions, with notes $0, 1, 1$.

  • The first note is $0$: no book to its left is taller, which simply means it is the tallest of the three. Then $a_1=5$.

  • With $a_1=5$ already set, the second position needs exactly one higher book to its left — which is $5$ — and the third position also needs exactly one. If $a_2=4$, then $a_2$ sees $5$ on its left: note $1$. And $a_3=2$ sees $5$ and $4$, but only $5$ and $4$ are greater than $2$, which would give $2$, not $1$. Instead, if $a_2=2$, go to $5$: note $1$. And $a_3=4$ sees $5$ and $2$, of which only $5$ is larger: note $1$. This order is the only one supported.

The complete row is: $ 5,\ 2,\ 4,\ 1,\ 3. $