Softwire interview question

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