Pergunta de entrevista da empresa UKCloud

Asked to write a function.