Question.
There are five people standing on a line: A, B, C, D and E. Each is asked how many people standing before them are taller than they are, and the replies from each were respectively: 0, 1, 1, 0 and 1. Sort these five people according to their height.
Solution.
People standing on a line: A, B, C, D and E.
Number of taller persons standing before: 0, 1, 1, 0 and 1.
A is the first person and nobody is standing before him, that is why the reply from A was, obviously, zero.
From B we have received the reply that one person before is taller than B. So A is taller than B.
And one person is taller C, therefore C is taller than B, but not A. At this step three people according to their height stand in line: ACB (from the tallest person to the smallest one).
D said: "0". Nobody is taller than D. So we obtain new line: DACB.
And the last person said: "1". He is smaller than only one of them, so the place for E is between D and A.
Consequently, the line of these five people according to their height is DEACB (from the tallest one).
**Answer:** DEACB.
Comments