I got this problem wrong when I encountered it during my practice test but looking at the solution and applying some reverse thinking I came up with following explanation which makes it little easier to quickly solve the problem.
Let's say we have 6 heights = {1, 2, 3, 4, 5, 6}
1st arrangement is obvious which is as following:
4 5 6 <- second row
1 2 3 <- first row
Now we need to think about other possible arrangements with given restrictions.
Couple of things we need to note:
1) Since 1 is smallest and 6 is greatest, they CANNOT be placed elsewhere from their current position. Hence their position is fixed and we need to only concern ourselves with position of rest of the 4 numbers i.e. {2, 3, 4, 5}
2) For other possible arrangements, the numbers from first row will have to go into second and from second row to 1 first row.
3) From {2, 3, 4, 5}, you cannot move both {2, 3} to second row (with {4, 5} moved to 1st row) as it will not satisfy the constraints in any arrangement.
4) Now looking at numbers just from second row, let's say if either of them has to placed in 1st row, they can only occupy 3rd position. Hence we have following two case:
Case 1: Placing {4} in third position of the first row, find arrangements of {2, 3, 5} that satisfy the constraints given in the problem.
_ _ 6
1 _ 4
Case 2: Placing {5} in third position of the first row, find arrangements of {2, 3, 4} that satisfy the constraints given in the problem.
_ _ 6
1 _ 5
In each of the two cases above, you will find two arrangements that satisfy constraints.
Case 1:
1st arrangement:
3 5 6
1 2 4
2nd arrangement:
2 5 6
1 3 4
Case 2:
1st arrangement:
3 4 6
1 2 5
2nd arrangement:
2 4 6
1 3 5
Hence, total arrangements: 1 + 2 + 2 = 5 arrangements.