Intuit interview question

Time and space complexity of code written