Pergunta de entrevista da empresa almatar

Solving an mid difficulty problem