Hint 1
Take the layout that A described from above and imagine that B is looking at it from the right-hand side. Working from left to right in B's description, each row of matchboxes would contain a maximum of: 2 piles x 2 layers 3 piles x 3 layers 3 piles x 1 layer 2 piles x 2 layers So the maximum possible number of matchboxes in this case would be 20.

