Google interview question

Time complexity and space complexity; python;