Pergunta de entrevista da empresa ServiceNow

coding question, it was done via hackerrank