Pergunta de entrevista da empresa Comcast

How would you approach coding this prompt