Pergunta de entrevista da empresa GTS

Single coding question with 4 hours to complete