Pergunta de entrevista da empresa F5

Solve the following coding question