Pergunta de entrevista da empresa Nagarro

two coding question in tech interview.