Virgin Gates Interview Question

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