Pergunta de entrevista da empresa Virgin Gates

How can we use this design pattern to solve this problem ?