Pregunta de entrevista de Nagarro

two coding question in tech interview.