**From New Scientist #2214, 27th November 1999** [link]

Pusicatto has been asked by a family to paint a picture consisting of a row of squares, which each square either red or green. Each member of the family has expressed a wish for something they would like to appear in the picture. For example, Mum asked for G??R?G, by which she meant that, somewhere in the row, there should be a green square, then two squares that could be of either colour, then a red square, then a square of either colour, and then a green square, without any other squares coming between them. Dad asked for G?R?R. The children’s requests were:

Kathy: R?G?R

Matthew: RG???G

Janet: G????R

Benjamin: R????R

Pusicatto decided to paint the picture so that it had the smallest number of squares possible.

What was the order of the squares in Pusicatto’s painting?

[enigma1058]

### Like this:

Like Loading...

This Python program considers possible paintings with increasing numbers of squares until it finds a solution.

It runs in 83ms.

Run:[ @repl.it ]Solution:Pussicato’s painting consists of 9 squares: GRRGRRRGG.Here’s a diagram showing how the painting meets all of the requirements.