Pregunta de entrevista de Softwire

two simple programming questions. Asked about time and space complexity.