Domanda di colloquio di Softwire

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